Skip to content

test(settlement): add full struct snapshot tests for PaymentReceivedEvent#552

Open
obswrld wants to merge 1 commit into
CalloraOrg:mainfrom
obswrld:test/settlement-receive-payment-snapshot
Open

test(settlement): add full struct snapshot tests for PaymentReceivedEvent#552
obswrld wants to merge 1 commit into
CalloraOrg:mainfrom
obswrld:test/settlement-receive-payment-snapshot

Conversation

@obswrld

@obswrld obswrld commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Closes #491

Changes

Added two snapshot tests that assert the complete PaymentReceivedEvent struct in a single assert_eq!, rather than checking fields individually:

  • test_payment_received_event_snapshot_to_pool — full struct assertion for the to_pool=true branch
  • test_payment_received_event_snapshot_to_developer — full struct assertion for the to_pool=false / developer branch

These complement the existing field-by-field event shape tests (test_payment_received_event_to_pool, etc.) by catching any future change to the event's structure or values in one comparison — if a field is added, removed, or renamed, or a value changes, the test fails immediately rather than silently passing because only some fields were checked.

Pre-existing build issue (out of scope)

contracts/settlement currently has 34 pre-existing compile errors on main that block cargo test from running for this crate:

  • Missing Severity, String, AdminBroadcast types referenced in lib.rs (broadcast function)
  • Argument count mismatches in unrelated withdraw_developer_balance test calls in test.rs
  • Missing Box import in test_invariant.rs

I verified via git stash that these errors exist on main independent of this change — this PR does not introduce them and does not attempt to fix them, as they're unrelated to this issue's scope. The new tests are syntactically correct and will pass once the crate compiles.

Acceptance Criteria

  • Test snapshot for settlement.receive_payment output structure added
  • Covers both branches (to_pool and to_developer)
  • Full struct comparison rather than per-field checks

…vent

- Add test_payment_received_event_snapshot_to_pool: asserts the complete
  PaymentReceivedEvent struct (from_vault, amount, to_pool, developer) in
  a single assert_eq! for the to_pool=true branch
- Add test_payment_received_event_snapshot_to_developer: same full-struct
  assertion for the to_pool=false / developer branch
- These complement the existing field-by-field event shape tests by
  catching any future change to the event's structure or values in one
  comparison, rather than requiring each field to be checked individually

Note: contracts/settlement currently has 34 pre-existing compile errors
on main (missing Severity/AdminBroadcast types in lib.rs, argument
mismatches in unrelated withdraw_developer_balance tests, missing Box
imports in test_invariant.rs) that block cargo test from running. These
are unrelated to this change and were verified to exist on main prior to
this branch via git stash comparison. This PR does not attempt to fix
them as they are out of scope for this issue.

Closes CalloraOrg#491
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@obswrld 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

@GBOYEE

GBOYEE commented Jun 28, 2026

Copy link
Copy Markdown

@GBOYEE has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

Write comprehensive tests covering the affected paths, add CI integration if missing, and ensure all tests pass before PR.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @GBOYEE to this issue.

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.

Add test snapshot for settlement.receive_payment output structure

2 participants