Repository navigation
test(core): add unit tests for TxUpdate methods - #2410
ravindra-RKB wants to merge 1 commit into
Conversation
Add unit tests covering TxUpdate methods in crates/core/tests/test_tx_update.rs: - test_is_empty_false_when_any_field_populated: verifies that is_empty() returns false when any of txs, txouts, anchors, seen_ats, or evicted_ats is populated. - test_extend: verifies that extending with an empty update is idempotent, extending an empty update populates all fields, and extending with a populated update properly combines txs, overwrites conflicting txouts, and unions all set fields. - test_map_anchors: verifies that map_anchors correctly transforms anchor types while preserving all transactions, txouts, seen_ats, and evicted_ats.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2410 +/- ##
==========================================
+ Coverage 80.00% 80.24% +0.24%
==========================================
Files 31 31
Lines 6187 6187
Branches 292 292
==========================================
+ Hits 4950 4965 +15
+ Misses 1167 1156 -11
+ Partials 70 66 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for putting this together, @ravindra-RKB. The tests are clear and CI is green. I'm going to close it, though, for the same reason as #2113 and #2116 (see #2111 (comment)). If you'd like to keep working on test coverage, these would help a lot more:
|
Description
Add unit test coverage for
TxUpdatemethods incrates/core/tests/test_tx_update.rs.TxUpdateis the primary interchange data structure used across BDK chain sources to communicate discovered transaction data, but its test target previously only checked default emptiness (test_empty).This adds test coverage for:
test_is_empty_false_when_any_field_populated: verifies thatis_empty()returns false when any individual field (txs,txouts,anchors,seen_ats,evicted_ats) is populated.test_extend: verifies extending with an empty update is idempotent, extending an empty update populates all fields, and extending with a populated update properly combinestxs, overwrites conflictingtxoutswith the new output, and unions set fields (anchors,seen_ats,evicted_ats).test_map_anchors: verifies thatmap_anchorstransforms anchor types while preserving all transactions, txouts, seen_ats, and evicted_ats.Notes to the reviewers
cargo test -p bdk_core --test test_tx_update.cargo fmt --all --checkand lints verified withcargo clippy -p bdk_core --all-targets -- -D warnings.Changelog notice
TxUpdatemethods inbdk_core.Checklists
All Submissions:
New Features: