Unit test#650
Merged
Merged
Conversation
|
@OmniZlatoon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
good day sir, please I would Like to continue working under your repo via drips platform. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #534
Walkthrough:
modified contract/src/test.rs by inserting three new dedicated tests right after the setup() function in the test_multi_session module. These perfectly map to the acceptance criteria defined in your request.
test_initialize_sets_admin_and_treasury
Verification: Called client.initialize() with the necessary arguments, including treasury and admin. Verified that client.get_treasury() successfully returns the configured treasury.
Admin Check: We verified that the admin was properly set and authorized by invoking an admin-only method (client.set_platform_fee()) from the admin's context.
test_initialize_twice_reverts
Verification: Registered a fresh contract, invoked initialize() once, and then intentionally invoked it a second time with the same parameters.
Error Handling: Implemented the #[should_panic(expected = "already initialized")] attribute above the test signature, which strictly asserts that the contract panics as expected when initialize() is called again.
test_uninitialized_contract_reverts
Verification: Registered a fresh contract but entirely skipped the initialize() method. Proceeded to call client.set_platform_fee().
Error Handling: Used the #[should_panic(expected = "not initialized")] attribute to assert that the contract successfully blocks unauthorized/uninitialized interactions.
test_initialize_emits_initialized_event
This test was already implemented in the existing test suite! It effectively checks the event queue for the Initialized topic and successfully matches the tuple (admin, treasury, dispute_window).