test: correctly create isolated test db in main.test.ts

This commit is contained in:
Jörg Krzeslak 2026-08-02 16:12:05 +02:00 committed by Laertes87
parent 396dd9f629
commit c2bebb1712
1 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,8 @@ import { Database } from "bun:sqlite";
import { mainConverter, chunks } from "../../src/converters/main";
// Isolated test database: avoids mutation of ./data/mydb.sqlite
const testDb = new Database(":memory:");
const testDbPath = `./data/test-db-${Date.now()}.sqlite`;
const testDb = new Database(testDbPath, { create: true });
mock.module("../../src/db/db", () => ({
db: testDb,
}));