test(sessions): stabilize pruning integration setup

This commit is contained in:
Vincent Koc
2026-03-20 10:17:48 -07:00
parent 58889f984f
commit fb3550ef5e

View File

@@ -10,11 +10,9 @@ vi.mock("../config.js", () => ({
loadConfig: vi.fn().mockReturnValue({}),
}));
type StoreModule = typeof import("./store.js");
import { loadConfig } from "../config.js";
import { clearSessionStoreCacheForTest, loadSessionStore, saveSessionStore } from "./store.js";
let clearSessionStoreCacheForTest: StoreModule["clearSessionStoreCacheForTest"];
let loadSessionStore: StoreModule["loadSessionStore"];
let saveSessionStore: StoreModule["saveSessionStore"];
let mockLoadConfig: ReturnType<typeof vi.fn>;
const DAY_MS = 24 * 60 * 60 * 1000;
@@ -81,10 +79,6 @@ describe("Integration: saveSessionStore with pruning", () => {
});
beforeEach(async () => {
vi.resetModules();
({ clearSessionStoreCacheForTest, loadSessionStore, saveSessionStore } =
await import("./store.js"));
const { loadConfig } = await import("../config.js");
mockLoadConfig = vi.mocked(loadConfig) as ReturnType<typeof vi.fn>;
testDir = await createCaseDir("pruning-integ");
storePath = path.join(testDir, "sessions.json");