From d0ae1cd07ed5ecf68a92d79e035dffb50034237d Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 21:32:49 +0100 Subject: [PATCH] test: verify repaired session records --- src/agents/session-file-repair.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/agents/session-file-repair.test.ts b/src/agents/session-file-repair.test.ts index 7b27cc81200..d4dd7d3272f 100644 --- a/src/agents/session-file-repair.test.ts +++ b/src/agents/session-file-repair.test.ts @@ -55,7 +55,11 @@ describe("repairSessionFileIfNeeded", () => { const backupPath = requireBackupPath(result); const repaired = await fs.readFile(file, "utf-8"); - expect(repaired.trim().split("\n")).toHaveLength(2); + const repairedLines = repaired + .trim() + .split("\n") + .map((line) => JSON.parse(line)); + expect(repairedLines).toEqual([header, message]); const backup = await fs.readFile(backupPath, "utf-8"); expect(backup).toBe(content); @@ -668,7 +672,7 @@ describe("repairSessionFileIfNeeded", () => { const after = await fs.readFile(file, "utf-8"); const lines = after.trimEnd().split("\n"); - expect(lines).toHaveLength(2); + expect(lines.map((line) => JSON.parse(line))).toEqual([header, message]); }); it("preserves non-`message` envelope types (e.g. compactionSummary, custom) without role inspection", async () => {