Registers the shared conformance suite every Store implementation must pass — the same
tests the built-in memory, Postgres, and MySQL stores run, with the memory adapter as the
oracle — so a custom store cannot silently diverge from the ledger invariants. Written for
node --test: called at the top level of a test file, it declares one describe block of 55
tests covering posting appends and bigint balance round-trips, balances re-derived from legs,
chain heads paired with raw leg sums and recomputed over the digest, checkpoints, entitlements,
the session journal, reservation counting, archival, transaction commit and rollback, batch
savepoint isolation, idempotency claim and replay, outbox and inbox once-delivery and
dead-lettering, promo reversal, saga listing and claiming, accrual rows, chain-link paging,
code-unit listing order, retention sweeps, and the table-size gauges. Tests for optional Store
surfaces (idempotency retention, journal pruning, table sizes) skip when the store does not
offer them.
The factory runs once in a before hook. If it throws, every test skips and names the thrown
reason instead of failing the suite — the connect-or-skip contract that lets the suite sit in
CI jobs with no backend provisioned. A store the factory did produce is closed in the after
hook.
runStoreConformance('my-store', () =>myStore(process.env.DATABASE_URL!)); // node --test runs the suite; passing proves the store upholds the built-ins' contract
Registers the shared conformance suite every Store implementation must pass — the same tests the built-in memory, Postgres, and MySQL stores run, with the memory adapter as the oracle — so a custom store cannot silently diverge from the ledger invariants. Written for
node --test: called at the top level of a test file, it declares onedescribeblock of 55 tests covering posting appends and bigint balance round-trips, balances re-derived from legs, chain heads paired with raw leg sums and recomputed over the digest, checkpoints, entitlements, the session journal, reservation counting, archival, transaction commit and rollback, batch savepoint isolation, idempotency claim and replay, outbox and inbox once-delivery and dead-lettering, promo reversal, saga listing and claiming, accrual rows, chain-link paging, code-unit listing order, retention sweeps, and the table-size gauges. Tests for optional Store surfaces (idempotency retention, journal pruning, table sizes) skip when the store does not offer them.The factory runs once in a
beforehook. If it throws, every test skips and names the thrown reason instead of failing the suite — the connect-or-skip contract that lets the suite sit in CI jobs with no backend provisioned. A store the factory did produce is closed in theafterhook.