mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 14:00:21 +00:00
test(config): reuse suite temp root tracker in session key normalization tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import type { MsgContext } from "../../auto-reply/templating.js";
|
||||
import { createSuiteTempRootTracker } from "../../test-helpers/temp-dir.js";
|
||||
import {
|
||||
clearSessionStoreCacheForTest,
|
||||
loadSessionStore,
|
||||
@@ -26,20 +26,28 @@ function createInboundContext(): MsgContext {
|
||||
}
|
||||
|
||||
describe("session store key normalization", () => {
|
||||
const suiteRootTracker = createSuiteTempRootTracker({
|
||||
prefix: "openclaw-session-key-normalize-",
|
||||
});
|
||||
let tempDir = "";
|
||||
let storePath = "";
|
||||
|
||||
beforeAll(async () => {
|
||||
await suiteRootTracker.setup();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-session-key-normalize-"));
|
||||
tempDir = await suiteRootTracker.make("case");
|
||||
storePath = path.join(tempDir, "sessions.json");
|
||||
await fs.writeFile(storePath, "{}", "utf-8");
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
clearSessionStoreCacheForTest();
|
||||
if (tempDir) {
|
||||
await fs.rm(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await suiteRootTracker.cleanup();
|
||||
});
|
||||
|
||||
it("records inbound metadata under a canonical lowercase key", async () => {
|
||||
|
||||
Reference in New Issue
Block a user