Skip to content

test: add regression coverage for seed idempotency and relationship reuse - #185

Open
SushmaS-05 wants to merge 1 commit into
github-samples:mainfrom
SushmaS-05:test/seed-idempotency
Open

SushmaS-05 wants to merge 1 commit into
github-samples:mainfrom
SushmaS-05:test/seed-idempotency

Conversation

@SushmaS-05

Copy link
Copy Markdown

Closes #163

Adds \db/seed.test.ts, exercising production \seedDatabase\ against an in-memory DB (\createTestDatabase) with temp CSV fixtures (cleaned up). Covers: relationship correctness/reuse, repeat-run full-snapshot idempotency, reuse of pre-existing categories/publishers, incremental additions, skip-not-reconcile for changed rows, and duplicate CSV titles.

Validation:
px vitest run db/seed.test.ts\ (6 passed),
pm run lint\ (clean),
pm run typecheck:all\ (0 errors).

…euse

Closes github-samples#163

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 06:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The first-run tests omit assertions for seeded descriptions and ratings, allowing empty descriptions or null ratings to pass while later snapshots only verify those values remain unchanged.

1 open issue
What changed in this PR

Adds regression tests for the production database seeder used during development and static builds, addressing the coverage gap in #163 without changing seeding behavior.

Changes:

  • Exercises seedDatabase against an in-memory database with temporary CSV fixtures and cleanup.
  • Checks relationship correctness and reuse, repeat-run idempotency, and incremental additions.
  • Covers preservation of existing games when CSV rows change and handling of duplicate titles.
File Description
db/​seed.test.ts Adds six integration tests for seed idempotency, relationship reuse, and record preservation.

Review effort: Balanced

Comment thread db/seed.test.ts
await seedDatabase(db, writeCsv('base.csv', BASE_ROWS));

const snap = await snapshot();
expect(snap.games).toHaveLength(3);
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.

[P1] Add regression coverage for seed idempotency and relationship reuse

3 participants