From 0746fda37cd3890ce5aff71482e697c0481275c5 Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 13:13:20 +0100 Subject: [PATCH] test: specify session export content --- .../src/host/session-files.test.ts | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/memory-host-sdk/src/host/session-files.test.ts b/packages/memory-host-sdk/src/host/session-files.test.ts index 2897798f19e..6685789b1d0 100644 --- a/packages/memory-host-sdk/src/host/session-files.test.ts +++ b/packages/memory-host-sdk/src/host/session-files.test.ts @@ -119,18 +119,15 @@ describe("buildSessionEntry", () => { fsSync.writeFileSync(filePath, jsonlLines.join("\n")); const entry = requireSessionEntry(await buildSessionEntry(filePath)); - // The content should have 3 lines (3 message records) - const contentLines = entry.content.split("\n"); - expect(contentLines).toHaveLength(3); - expect(contentLines[0]).toContain("User: Hello world"); - expect(contentLines[1]).toContain("Assistant: Hi there"); - expect(contentLines[2]).toContain("User: Tell me a joke"); + expect(entry.content).toBe( + "User: Hello world\nAssistant: Hi there, how can I help?\nUser: Tell me a joke", + ); // lineMap should map each content line to its original JSONL line (1-indexed) // Content line 0 → JSONL line 4 (the first user message) // Content line 1 → JSONL line 6 (the assistant message) // Content line 2 → JSONL line 7 (the second user message) - expect(entry.lineMap).toEqual([4, 6, 7]); + expect(entry.lineMap).toStrictEqual([4, 6, 7]); }); it("returns empty lineMap when no messages are found", async () => { @@ -170,10 +167,10 @@ describe("buildSessionEntry", () => { // Usage-counted archives (reset, deleted) must surface real content so // post-reset memory_search can recover prior session history. - expect(resetEntry.content).toContain("User: Archived hello"); - expect(resetEntry.lineMap).toEqual([1]); - expect(deletedEntry.content).toContain("User: Archived hello"); - expect(deletedEntry.lineMap).toEqual([1]); + expect(resetEntry.content).toBe("User: Archived hello"); + expect(resetEntry.lineMap).toStrictEqual([1]); + expect(deletedEntry.content).toBe("User: Archived hello"); + expect(deletedEntry.lineMap).toStrictEqual([1]); // .bak and compaction checkpoints remain opaque pre-archive / snapshot // artifacts and stay empty so they do not get double-indexed. @@ -240,7 +237,7 @@ describe("buildSessionEntry", () => { fsSync.writeFileSync(filePath, jsonlLines.join("\n")); const entry = requireSessionEntry(await buildSessionEntry(filePath)); - expect(entry.lineMap).toEqual([3, 5]); + expect(entry.lineMap).toStrictEqual([3, 5]); }); it("strips inbound metadata when a user envelope is split across text blocks", async () => { @@ -296,6 +293,6 @@ describe("buildSessionEntry", () => { const entry = requireSessionEntry(await buildSessionEntry(filePath)); expect(entry.content).toBe("Assistant: User-facing summary.\nUser: Actual user follow-up."); - expect(entry.lineMap).toEqual([2, 3]); + expect(entry.lineMap).toStrictEqual([2, 3]); }); });