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

test: add integration tests for Pausable plugins #51

Merged
merged 7 commits into from
Dec 21, 2022

Conversation

mooori
Copy link
Contributor

@mooori mooori commented Dec 20, 2022

Previously Pausable was tested by unit tests via near_sdk::testing_env, which mocks the chain.

The new integration tests compile the contract in near-plugins/tests/contracts/pausable, deploy it on chain via near workspaces and send transactions to it.

This is a step towards having only one contract for the Pausable plugin which is used for tests and serves as documentation resp. example, as laid out in #48. In a follow up PR I’ll clean up duplicate example contracts.

Other changes: refactor near-plugins/tests/common

  • Removed superfluous types that complicated the code.
  • Generalized helper functions to be used in tests of multiple plugins. Prior only AccessControllable was tested via integration tests.

@mooori mooori marked this pull request as ready for review December 20, 2022 17:43
@mooori mooori requested a review from birchmd December 20, 2022 17:44
Copy link

@birchmd birchmd left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, nice job! Just a few nits.

near-plugins/tests/pausable.rs Outdated Show resolved Hide resolved
@mooori mooori requested a review from birchmd December 21, 2022 09:45
Copy link

@birchmd birchmd left a comment

Choose a reason for hiding this comment

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

LTGM, nice work

}

/// Exposing internal methods to facilitate integration testing.
/// TODO needed for this contract?
Copy link

Choose a reason for hiding this comment

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

Is this question answered now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turned out that these functions are not needed for the Pausable test contract. They're removed in 5fe4f37.

Thanks for catching another open TODO!

@mooori
Copy link
Contributor Author

mooori commented Dec 21, 2022

CI is green and I've double checked that there are no more open TODOs related to this PR, so merging now.

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.

3 participants