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

Demo unit test querier #45

Merged
merged 4 commits into from
Aug 19, 2021
Merged

Demo unit test querier #45

merged 4 commits into from
Aug 19, 2021

Conversation

ethanfrey
Copy link
Contributor

This starts showing how to unit test code with a fake querier and not always the full-stack multitest app

@ethanfrey ethanfrey requested a review from hashedone August 17, 2021 11:33
Copy link
Collaborator

@hashedone hashedone left a comment

Choose a reason for hiding this comment

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

Went through this, I am happy with this possibility, also think that it is good to have this test in repo so will merge.

One more think I would actually wish exist is implementation of Querier which is configurable like mocks/stubs (see - mocks in mockall crate). Basically so instead of creating my fake querier, there would be something like QuerierStub used like:

let querier = QuerierStub::new()
  .on(|query| /* some predicate */, |query| /* answer to this query if matches predicate*/);

@hashedone hashedone merged commit 759936e into main Aug 19, 2021
@ethanfrey
Copy link
Contributor Author

I agree.

Look at CosmWasm/cosmwasm#1050 for an issue in that direction. Happy if you add more ideas there.

We also could make such a class in cosmwasm-plus first, try it out in tests, and when we are happy with the api, make a pr to add it to cosmwasm

@ueco-jb ueco-jb deleted the demo-unit-test-querier branch August 30, 2022 13:45
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