Repository navigation
test: add regression coverage for seed idempotency and relationship reuse - #185
Open
SushmaS-05 wants to merge 1 commit into
Open
SushmaS-05 wants to merge 1 commit into
SushmaS-05 wants to merge 1 commit into
Conversation
…euse Closes github-samples#163 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 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
seedDatabaseagainst 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
| await seedDatabase(db, writeCsv('base.csv', BASE_ROWS)); | ||
|
|
||
| const snap = await snapshot(); | ||
| expect(snap.games).toHaveLength(3); |
nandakishore-s-13
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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).