fix(test): use setImmediate drain instead of sleep for history insert timing

This commit is contained in:
can1357
2026-04-08 12:29:12 +02:00
parent edab058993
commit 88595b541c
@@ -47,7 +47,8 @@ it("migrates legacy history schema away from unixepoch defaults", async () => {
const storage = HistoryStorage.open(dbPath);
storage.add("new prompt", "/tmp/new");
await Bun.sleep(100);
// add() defers the INSERT via setImmediate; drain the macrotask queue
await new Promise<void>(resolve => setImmediate(resolve));
const db = new Database(dbPath, { readonly: true });
try {