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

Addons #98

Merged
merged 11 commits into from
Nov 23, 2023
Merged

Addons #98

merged 11 commits into from
Nov 23, 2023

Conversation

DariuszDepta
Copy link
Member

@DariuszDepta DariuszDepta commented Nov 16, 2023

Prepared module named addons, where additional components or extensions to MultiTest will be placed.
Add-ons are not required (or crucial) to use MultiTest in common testing scenarios, but provide additional functionalities, that may be used while testing CosmWasm smart contracts.

Add-ons provided in this PR:

  • crate::addons::MockAddressGenerator
  • crate::addons::MockApiBech32
  • crate::addons::MockApiBech32m

Please consult the source code documentation to learn more about these add-ons.

Using provided add-ons, writing tests with Bech32 addresses is now simpler, e.g.:

    // prepare the application with Bech32 Api and mock address generator
    let mut app = AppBuilder::default()
        .with_api(MockApiBech32::new("juno"))
        .with_wasm(WasmKeeper::default().with_address_generator(MockAddressGenerator))
        .build(|_, _, _| {});

    // test your contract
    // ...

@DariuszDepta DariuszDepta self-assigned this Nov 16, 2023
@DariuszDepta DariuszDepta added this to the 0.19.0 milestone Nov 17, 2023
@DariuszDepta DariuszDepta added the enhancement New feature or request label Nov 17, 2023
@DariuszDepta
Copy link
Member Author

DariuszDepta commented Nov 17, 2023

@webmaster128 This is the proposal of a concept of providing add-ons instead separate crates. Provided add-ons in this PR meet the needs reported e.g. here: #95, without copying and pasting the same code by test creators.

@DariuszDepta DariuszDepta requested review from hashedone and removed request for webmaster128 November 20, 2023 13:29
Copy link
Contributor

@chipshort chipshort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall concept looks good to me. Great docs!
Just a few small things from my side.

src/addons/addresses/mock.rs Show resolved Hide resolved
src/addons/addresses/mod.rs Outdated Show resolved Hide resolved
tests/test_addons/test_api/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@chipshort chipshort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DariuszDepta DariuszDepta merged commit 712521e into main Nov 23, 2023
7 checks passed
@DariuszDepta DariuszDepta deleted the addons branch November 23, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants