Skip to content

test: add integration tests for Pausable plugins#51

Merged
mooori merged 7 commits into
near:masterfrom
mooori:pausable-tests
Dec 21, 2022
Merged

test: add integration tests for Pausable plugins#51
mooori merged 7 commits into
near:masterfrom
mooori:pausable-tests

Conversation

@mooori
Copy link
Copy Markdown
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
Copy Markdown

@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.

Comment thread near-plugins/tests/contracts/pausable/Makefile
Comment thread near-plugins/tests/contracts/pausable/rust-toolchain
Comment thread near-plugins/tests/pausable.rs Outdated
@mooori mooori requested a review from birchmd December 21, 2022 09:45
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

This was referenced Mar 27, 2026
This was referenced Apr 7, 2026
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