mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: tighten auto reply cleanup assertions
This commit is contained in:
@@ -12,6 +12,10 @@ import { createTestFollowupRun, writeTestSessionStore } from "./agent-runner.tes
|
||||
const refreshQueuedFollowupSessionMock = vi.fn();
|
||||
const errorMock = vi.fn();
|
||||
|
||||
async function expectPathMissing(targetPath: string): Promise<void> {
|
||||
await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
}
|
||||
|
||||
describe("resetReplyRunSession", () => {
|
||||
let rootDir = "";
|
||||
|
||||
@@ -131,6 +135,6 @@ describe("resetReplyRunSession", () => {
|
||||
onNewSession: () => {},
|
||||
});
|
||||
|
||||
await expect(fs.access(oldTranscriptPath)).rejects.toThrow();
|
||||
await expectPathMissing(oldTranscriptPath);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,6 +30,10 @@ async function readJsonlRecords(filePath: string): Promise<ReplayRecord[]> {
|
||||
return records;
|
||||
}
|
||||
|
||||
async function expectPathMissing(targetPath: string): Promise<void> {
|
||||
await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
}
|
||||
|
||||
describe("replayRecentUserAssistantMessages", () => {
|
||||
let root = "";
|
||||
beforeEach(async () => {
|
||||
@@ -73,7 +77,7 @@ describe("replayRecentUserAssistantMessages", () => {
|
||||
).join("");
|
||||
await fs.writeFile(assistantSource, onlyAssistants, "utf8");
|
||||
expect(await call(assistantSource, assistantTarget)).toBe(0);
|
||||
await expect(fs.stat(assistantTarget)).rejects.toThrow();
|
||||
await expectPathMissing(assistantTarget);
|
||||
});
|
||||
|
||||
it("skips header for pre-existing targets and aligns the tail to a user turn", async () => {
|
||||
|
||||
Reference in New Issue
Block a user