Skip to content

test(alert-registry): verify updated_at > created_at and 50-rule limit#157

Merged
habiba-d-coder merged 1 commit into
Tx-wat:mainfrom
pugsleyonesimus-dev:test/updated-at-and-50-rules-validation
May 30, 2026
Merged

test(alert-registry): verify updated_at > created_at and 50-rule limit#157
habiba-d-coder merged 1 commit into
Tx-wat:mainfrom
pugsleyonesimus-dev:test/updated-at-and-50-rules-validation

Conversation

@pugsleyonesimus-dev
Copy link
Copy Markdown
Contributor

closes #50
closes #55

Summary

Two new unit tests added to contracts/alert-registry/src/lib.rs.

test_updated_at_strictly_greater_than_created_at

Advances the Soroban ledger timestamp by 1 second between register_alert
and update_alert using env.ledger().with_mut(), then asserts:

  • created_at == updated_at immediately after registration
  • updated_at > created_at strictly after the update call

test_register_alert_with_50_rules_no_instruction_limit

Registers an alert with exactly 50 valid rules (alternating rule:transfer
/ rule:mint) and confirms:

  • All 50 entries are persisted without hitting the Soroban instruction budget
  • Spot-checks indices 0, 1, 48, and 49 for data integrity

What was tested

  • Both tests are self-contained unit tests using the existing setup() helper
  • No new dependencies introduced

- Add test_updated_at_strictly_greater_than_created_at: advances the
  Soroban ledger timestamp by 1 second between register_alert and
  update_alert, then asserts updated_at is strictly greater than
  created_at after the call.

- Add test_register_alert_with_50_rules_no_instruction_limit: registers
  an alert with exactly 50 valid rules (alternating rule:transfer /
  rule:mint) and confirms all 50 entries are persisted without hitting
  the Soroban instruction budget.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@pugsleyonesimus-dev 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

@habiba-d-coder habiba-d-coder merged commit e6da3e6 into Tx-wat:main May 30, 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.

Test: Add test for register_alert with a large rules vector (50+ rules) Test: Add test verifying updated_at changes on update_alert

2 participants