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.
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
tests/event_snapshots.rsexercising a representative flow.tests/snapshots/event_flow.snapserialized as a JSONL or known text format.Implementation Notes
env.events()returns aEventsiterator in Soroban 26.x; serialize each into text for diffing.Affected Files / Modules
campaign/tests/event_snapshots.rs(usesinstacrate)campaign/Cargo.toml(dev-depinsta)campaign/tests/snapshots/event_flow.snapDependencies — None.