--- name: Test database setup pattern description: How to create isolated test databases for store and handler tests in this project type: feedback --- Use `os.CreateTemp` to create a temporary SQLite file for each test. Pass that file path to `store.New`. **Why:** `store.New` always appends `?_journal_mode=WAL&_foreign_keys=ON` to the path argument. If you pass a URI like `file:name?mode=memory&cache=shared`, the result is a malformed DSN (`...?mode=memory&cache=shared?_journal_mode=WAL&...`) that SQLite rejects with "no such cache mode: shared". **How to apply:** In every `newTestStore` / `newHandlerWithStore` helper, do: ```go f, _ := os.CreateTemp("", "krafttrainer-test-*.db") f.Close() dbPath := f.Name() s, err := store.New(dbPath) t.Cleanup(func() { s.Close(); os.Remove(dbPath) }) ```