sbtc-developer-release
sbtc-developer-release copied to clipboard
test: Add `Codec` trait unit tests
Summary of Changes
-
Add unit tests to
codec.rs
to assertCodec
implementations for the following works as expected:-
bdk::bitcoin::Amount
-
bdk::bitcoin::Script
-
bdk::bitcoin::secp256k1::ecdsa::RecoverableSignature
-
u64
-
-
Add
anyhow
crate tostacks-core
for easy error propagation in unit tests.
NOTE: There are some assertions against hex representations of the expected value to keep the tests as readable as possible and to avoid replicating the serialization or deserialization code. Formal snapshot testing using a crate like
insta
can prove a more scalable alternative asserting between complex values.
Testing
Run tests normally via cargo make test
.
Risks
None.
How were these changes tested?
Changes are tests themselves and were verified by running cargo make test
.
What future testing should occur?
None.
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
@CAGS295 seems like merging is blocked due to one workflow needing approval. Is there something else I need to do to get this merged?
Hi @ldiego08, thank you for your contribution. You need to wait for a core maintainer to approve the workflow. @AshtonStephens