Commit Graph

1 Commits

Author SHA1 Message Date
fullex
6aeb14d6d1 docs(testing): add database-testing guide and update CLAUDE.md
New guide at docs/references/testing/database-testing.md describing:
  - When to use setupTestDatabase() (and when not to).
  - Options, lifecycle behaviour, and PRAGMA handling.
  - Migration recipe (before/after diffs) for converting legacy tests.
  - Anti-patterns: vi.mock('@application') override, hand-written
    CREATE TABLE SQL, describe.concurrent within harness scope,
    nested setupTestDatabase() calls, re-adding the
    vi.mock('node:fs', importOriginal) escape hatch.
  - Gotchas: LibSQL transaction connection recycle + setPragma replay,
    pathToFileURL for Windows, FTS5 with NULL content, truncate-vs-drop.

Linked from CLAUDE.md's Testing Guidelines section so future
contributors find the convention.
2026-04-15 09:34:28 -07:00