Skip to content

Add snapshot tests for every public event #27

Description

@P3az3

Problem Statement

Smart contract events are the contract's public observability surface. The tests verify state but never directly assert the serialized event shape. A future change to event::donation_received (e.g. accidental field reordering, wrong tuple shape) would not be caught until integration with off-chain tooling.

Expected Outcome

Add a snapshot-style integration test that emits a representative flow (initialize, donate x3, release x1) and serializes the events via env.events().all() (or equivalent). Compare against a snapshot fixture.

Acceptance Criteria

  • New test tests/event_snapshots.rs exercising a representative flow.
  • Snapshot file tests/snapshots/event_flow.snap serialized as a JSONL or known text format.
  • CI gates any change to the event shape.

Implementation Notes

  • env.events() returns a Events iterator in Soroban 26.x; serialize each into text for diffing.

Affected Files / Modules

  • New: campaign/tests/event_snapshots.rs (uses insta crate)
  • campaign/Cargo.toml (dev-dep insta)
  • New: campaign/tests/snapshots/event_flow.snap

Dependencies — None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26observabilityTracing, metrics, dashboarding surface.priority/p2Should-do in current quarter.snapshotSnapshot / golden-file test.testingTest coverage or tooling.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions