Skip to content

Unit test#650

Merged
nafiuishaaq merged 2 commits into
MentoNest:mainfrom
OmniZlatoon:unit-test
May 31, 2026
Merged

Unit test#650
nafiuishaaq merged 2 commits into
MentoNest:mainfrom
OmniZlatoon:unit-test

Conversation

@OmniZlatoon
Copy link
Copy Markdown
Contributor

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

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@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! 🚀

Learn more about application limits

@nafiuishaaq nafiuishaaq merged commit aaaac57 into MentoNest:main May 31, 2026
1 check failed
@OmniZlatoon
Copy link
Copy Markdown
Contributor Author

good day sir, please I would Like to continue working under your repo via drips platform.
Can you please assign me issues when I request? I would be very devoted to do the task and complete them on time and with the expected output.

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.

Unit test — Contract initialization

2 participants