Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary Wallet::database_mut method #8

Open
wants to merge 6 commits into
base: test-helper-refactor
Choose a base branch
from

Conversation

evanlinjin
Copy link

No description provided.

rajarshimaitra and others added 6 commits August 31, 2022 18:33
 - Few test helpers and macros are scattered around `database/memory.rs` and
`wallet/mod.rs`. These are collected in a single place `testutils/helpers.rs`.

 - the `populate_test_db` macro is changed into a function. Internal logic
 should remain same.

 - A new `run_tests_with_init` macro is added in `testutils.helpers.rs`,
 which can run database tests given an initializer function.

Co-authored-by: SanthoshAnguluri <[email protected]>
Co-authored-by: saikishore222 <[email protected]>
 - in `keyvalue.rs`, `memory.rs`, `sqlite.rs` use the `run_tests_with_init`
 macro to run database tests.

 - in `wallet/mod.rs` update all the test calls from macro to function for
 `populate_test_db`.

 - some import fixes in `address_validator.rs` and `psbt/mod.rs`.

Co-authored-by: SanthoshAnguluri <[email protected]>
Co-authored-by: saikishore222 <[email protected]>
Similar to the database `run_test_with_init` another `make_blockchain_test`
macro is added, which will run the blockchain tests given a initilizer
function.

These test functions are taken out of the macro and are placed as their own
public functions.

A doc comment explaining how to use the tests externally from bdk is
added before the `blockchain_tests::test` module.

Co-authored-by: SanthoshAnguluri <[email protected]>
Co-authored-by: saikishore222 <[email protected]>
Apply the new `make_blockchain_test` macro to run the blockchain tests
for rpc, electrum and esplora blockchain.

Co-authored-by: SanthoshAnguluri <[email protected]>
Co-authored-by: saikishore222 <[email protected]>
Co-authored-by: SanthoshAnguluri <[email protected]>
Co-authored-by: saikishore222 <[email protected]>
This method is only relevant for testing, so we make the
`Wallet::database` field `pub(crate)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants