Skip to content

test(contract): assert StatusUpdated event emitted on mark_processing…#626

Open
samuelisi wants to merge 1 commit intoSynapse-bridgez:mainfrom
samuelisi:test/status-updated-events
Open

test(contract): assert StatusUpdated event emitted on mark_processing…#626
samuelisi wants to merge 1 commit intoSynapse-bridgez:mainfrom
samuelisi:test/status-updated-events

Conversation

@samuelisi
Copy link
Copy Markdown

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

  • 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

… 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
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

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

Learn more about application limits

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.

#599 Test: mark_completed emits StatusUpdated event #598 Test: mark_processing emits StatusUpdated event

2 participants