test: verify repaired session records

This commit is contained in:
Shakker
2026-05-11 21:32:49 +01:00
parent 00d807c67b
commit d0ae1cd07e

View File

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