@@ -11,10 +11,8 @@ vi.mock("../config.js", async () => ({
|
11 | 11 | loadConfig: vi.fn().mockReturnValue({}), |
12 | 12 | })); |
13 | 13 | |
14 | | -let loadConfig: typeof import("../config.js").loadConfig; |
15 | | -let clearSessionStoreCacheForTest: typeof import("./store.js").clearSessionStoreCacheForTest; |
16 | | -let loadSessionStore: typeof import("./store.js").loadSessionStore; |
17 | | -let saveSessionStore: typeof import("./store.js").saveSessionStore; |
| 14 | +import { loadConfig } from "../config.js"; |
| 15 | +import { clearSessionStoreCacheForTest, loadSessionStore, saveSessionStore } from "./store.js"; |
18 | 16 | |
19 | 17 | let mockLoadConfig: ReturnType<typeof vi.fn>; |
20 | 18 | |
@@ -88,21 +86,17 @@ describe("Integration: saveSessionStore with pruning", () => {
|
88 | 86 | }); |
89 | 87 | |
90 | 88 | beforeEach(async () => { |
91 | | -vi.resetModules(); |
92 | | -({ loadConfig } = await import("../config.js")); |
93 | | -({ clearSessionStoreCacheForTest, loadSessionStore, saveSessionStore } = |
94 | | -await import("./store.js")); |
95 | 89 | mockLoadConfig = vi.mocked(loadConfig) as ReturnType<typeof vi.fn>; |
| 90 | +mockLoadConfig.mockReset(); |
96 | 91 | testDir = await createCaseDir("pruning-integ"); |
97 | 92 | storePath = path.join(testDir, "sessions.json"); |
98 | 93 | savedCacheTtl = process.env.OPENCLAW_SESSION_CACHE_TTL_MS; |
99 | 94 | process.env.OPENCLAW_SESSION_CACHE_TTL_MS = "0"; |
100 | 95 | clearSessionStoreCacheForTest(); |
101 | | -mockLoadConfig.mockClear(); |
102 | 96 | }); |
103 | 97 | |
104 | 98 | afterEach(() => { |
105 | | -vi.restoreAllMocks(); |
| 99 | +mockLoadConfig.mockReset(); |
106 | 100 | clearSessionStoreCacheForTest(); |
107 | 101 | if (savedCacheTtl === undefined) { |
108 | 102 | delete process.env.OPENCLAW_SESSION_CACHE_TTL_MS; |
|