fix: AsyncDrain double-allocation bug and history test singleton isolation

This commit is contained in:
can1357
2026-04-08 12:52:32 +02:00
parent 468601935c
commit 2bdc80eedc
2 changed files with 12 additions and 3 deletions
@@ -1,5 +1,5 @@
import { Database } from "bun:sqlite";
import { afterEach, expect, it } from "bun:test";
import { afterEach, beforeEach, expect, it } from "bun:test";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
@@ -21,7 +21,12 @@ function readTableSql(dbPath: string, tableName: string): string | null {
let tempDir = "";
beforeEach(() => {
HistoryStorage.resetInstance();
});
afterEach(async () => {
HistoryStorage.resetInstance();
if (tempDir) {
await fs.rm(tempDir, { recursive: true, force: true });
tempDir = "";