test: tighten auto reply cleanup assertions

This commit is contained in:
Shakker
2026-05-09 02:49:39 +01:00
parent 4d8e0bcecc
commit ecc7e3c7b5
2 changed files with 10 additions and 2 deletions

View File

@@ -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);
});
});

View File

@@ -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 () => {