Skip to content

test(checkpoint): replace vacuous interface tests with behavioural co… - #229

Open
N-otorious wants to merge 1 commit into
Miracle656:mainfrom
N-otorious:test/checkpoint-behavioural-coverage
Open

N-otorious wants to merge 1 commit into
Miracle656:mainfrom
N-otorious:test/checkpoint-behavioural-coverage

Conversation

@N-otorious

Copy link
Copy Markdown

test(checkpoint): replace vacuous interface tests with behavioural coverage

The existing checkpoint.test.ts only asserted on TypeScript interface literals — no runtime code was exercised.
commitBatch and hasCheckpoint in src/indexer/checkpoint.ts were at 0% coverage despite implementing the
exactly-once ingest guarantee from #101.

This PR replaces the three no-op cases with 14 behavioural tests against a mocked Prisma client, covering the three
outcomes that matter for exactly-once semantics: a fresh batch inserts and advances the checkpoint; a replayed
batchId is a no-op (idempotent via skipDuplicates); a failed insert propagates the error and leaves the checkpoint
upsert unreached. checkpoint.ts moves from 0% to 86.95% statement coverage.

checkpoint.ts is still not wired into startIndexer().
closes #191

…verage

The existing checkpoint.test.ts only asserted on TypeScript interface
literals — no runtime code was exercised. commitBatch and hasCheckpoint
in src/indexer/checkpoint.ts were at 0% coverage despite implementing
the exactly-once ingest guarantee from Miracle656#101.

Replaces the three no-op cases with 14 behavioural tests against a
mocked Prisma client, covering the three outcomes that matter:
- fresh batch inserts and advances the checkpoint
- replayed batchId is a no-op (idempotent via skipDuplicates)
- failed insert propagates the error and leaves the checkpoint upsert
  unreached

checkpoint.ts moves from 0% to 86.95% statement coverage.

checkpoint.ts is still not wired into startIndexer().

This branch has not been deployed

No deployments
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.

Replace the placeholder checkpoint test with real coverage

1 participant