test: group remaining suite cleanups

This commit is contained in:
Peter Steinberger
2026-02-21 21:43:24 +00:00
parent 5c8f0b5a77
commit 861718e4dc
32 changed files with 870 additions and 922 deletions

View File

@@ -10,6 +10,8 @@ import type { SessionEntry } from "./types.js";
vi.mock("../config.js", () => ({
loadConfig: vi.fn().mockReturnValue({}),
}));
const { loadConfig } = await import("../config.js");
const mockLoadConfig = vi.mocked(loadConfig) as ReturnType<typeof vi.fn>;
const DAY_MS = 24 * 60 * 60 * 1000;
@@ -45,7 +47,6 @@ describe("Integration: saveSessionStore with pruning", () => {
let testDir: string;
let storePath: string;
let savedCacheTtl: string | undefined;
let mockLoadConfig: ReturnType<typeof vi.fn>;
beforeAll(async () => {
fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-pruning-integ-"));
@@ -61,9 +62,7 @@ describe("Integration: saveSessionStore with pruning", () => {
savedCacheTtl = process.env.OPENCLAW_SESSION_CACHE_TTL_MS;
process.env.OPENCLAW_SESSION_CACHE_TTL_MS = "0";
clearSessionStoreCacheForTest();
const configModule = await import("../config.js");
mockLoadConfig = configModule.loadConfig as ReturnType<typeof vi.fn>;
mockLoadConfig.mockReset();
});
afterEach(() => {