Skip to content

Implement SDK response snapshot testing for API contract verification #393

Description

@Kingsman-99

Overview

SDK method return shapes are tested implicitly by unit tests but never asserted against a locked snapshot. Add snapshot tests so any accidental breaking change to a returned object's shape fails CI immediately.

Acceptance Criteria

  • Snapshot tests using Vitest's toMatchSnapshot() for all read methods: getInvoice, getLeaderboard, getInvoiceHistory, getInvoiceExt, getStats
  • Snapshots stored in tests/snapshots/ directory and committed to the repo
  • Snapshots use deterministic fixture data (no timestamps or ledger sequences that change)
  • bigint fields serialized as strings in snapshots (Jest/Vitest snapshot format)
  • Snapshot update command: vitest run --update-snapshots (documented in CONTRIBUTING.md)
  • CI fails if any snapshot diverges without an explicit update commit
  • Snapshot diff shown in PR comment when snapshots change (via GitHub Actions)

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions