test(contract): assert StatusUpdated event emitted on mark_processing…#626
Open
samuelisi wants to merge 1 commit intoSynapse-bridgez:mainfrom
Open
test(contract): assert StatusUpdated event emitted on mark_processing…#626samuelisi wants to merge 1 commit intoSynapse-bridgez:mainfrom
samuelisi wants to merge 1 commit intoSynapse-bridgez:mainfrom
Conversation
… and mark_completed Closes Synapse-bridgez#135. Depends on Synapse-bridgez#90. ## Why No tests in tests/contract_test.rs were asserting that the StatusUpdated event is emitted during the Pending → Processing and Processing → Completed status transitions. This left a gap in event coverage for two of the most critical lifecycle steps in the deposit flow. ## What changed Added two new tests to tests/contract_test.rs: - test_mark_processing_emits_status_updated Registers a deposit (Pending), calls mark_processing, then scans the full event log to assert that Event::StatusUpdated(tx_id, TransactionStatus::Processing) was emitted with the correct tx_id. - test_mark_completed_emits_status_updated Registers a deposit, advances it through Pending → Processing → Completed, then asserts that Event::StatusUpdated(tx_id, TransactionStatus::Completed) was emitted with the correct tx_id. ## How it works Both tests use env.events().all() to collect all emitted events after the state transition, filter by the 'synapse' topic symbol and the contract address, then pattern-match the deserialized payload against the expected Event::StatusUpdated variant, verifying both the tx_id and the new TransactionStatus value. ## Notes - Follows the same event-assertion pattern already established in tests/contract_test.rs and tests/issue_135_status_updated_event_test.rs - register_deposit uses 8 arguments matching the current contract signature - No production code was modified
|
@samuelisi 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! 🚀 |
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 #598
closes #599
… and mark_completed
Closes #135. Depends on #90.
Why
No tests in tests/contract_test.rs were asserting that the StatusUpdated event is emitted during the Pending → Processing and Processing → Completed status transitions. This left a gap in event coverage for two of the most critical lifecycle steps in the deposit flow.
What changed
Added two new tests to tests/contract_test.rs:
test_mark_processing_emits_status_updated Registers a deposit (Pending), calls mark_processing, then scans the full event log to assert that Event::StatusUpdated(tx_id, TransactionStatus::Processing) was emitted with the correct tx_id.
test_mark_completed_emits_status_updated Registers a deposit, advances it through Pending → Processing → Completed, then asserts that Event::StatusUpdated(tx_id, TransactionStatus::Completed) was emitted with the correct tx_id.
How it works
Both tests use env.events().all() to collect all emitted events after the state transition, filter by the 'synapse' topic symbol and the contract address, then pattern-match the deserialized payload against the expected Event::StatusUpdated variant, verifying both the tx_id and the new TransactionStatus value.
Notes