























@@ -119,18 +119,15 @@ describe("buildSessionEntry", () => {
119119fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
120120121121const entry = requireSessionEntry(await buildSessionEntry(filePath));
122-// The content should have 3 lines (3 message records)
123-const contentLines = entry.content.split("\n");
124-expect(contentLines).toHaveLength(3);
125-expect(contentLines[0]).toContain("User: Hello world");
126-expect(contentLines[1]).toContain("Assistant: Hi there");
127-expect(contentLines[2]).toContain("User: Tell me a joke");
122+expect(entry.content).toBe(
123+"User: Hello world\nAssistant: Hi there, how can I help?\nUser: Tell me a joke",
124+);
128125129126// lineMap should map each content line to its original JSONL line (1-indexed)
130127// Content line 0 → JSONL line 4 (the first user message)
131128// Content line 1 → JSONL line 6 (the assistant message)
132129// Content line 2 → JSONL line 7 (the second user message)
133-expect(entry.lineMap).toEqual([4, 6, 7]);
130+expect(entry.lineMap).toStrictEqual([4, 6, 7]);
134131});
135132136133it("returns empty lineMap when no messages are found", async () => {
@@ -170,10 +167,10 @@ describe("buildSessionEntry", () => {
170167171168// Usage-counted archives (reset, deleted) must surface real content so
172169// post-reset memory_search can recover prior session history.
173-expect(resetEntry.content).toContain("User: Archived hello");
174-expect(resetEntry.lineMap).toEqual([1]);
175-expect(deletedEntry.content).toContain("User: Archived hello");
176-expect(deletedEntry.lineMap).toEqual([1]);
170+expect(resetEntry.content).toBe("User: Archived hello");
171+expect(resetEntry.lineMap).toStrictEqual([1]);
172+expect(deletedEntry.content).toBe("User: Archived hello");
173+expect(deletedEntry.lineMap).toStrictEqual([1]);
177174178175// .bak and compaction checkpoints remain opaque pre-archive / snapshot
179176// artifacts and stay empty so they do not get double-indexed.
@@ -240,7 +237,7 @@ describe("buildSessionEntry", () => {
240237fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
241238242239const entry = requireSessionEntry(await buildSessionEntry(filePath));
243-expect(entry.lineMap).toEqual([3, 5]);
240+expect(entry.lineMap).toStrictEqual([3, 5]);
244241});
245242246243it("strips inbound metadata when a user envelope is split across text blocks", async () => {
@@ -296,6 +293,6 @@ describe("buildSessionEntry", () => {
296293297294const entry = requireSessionEntry(await buildSessionEntry(filePath));
298295expect(entry.content).toBe("Assistant: User-facing summary.\nUser: Actual user follow-up.");
299-expect(entry.lineMap).toEqual([2, 3]);
296+expect(entry.lineMap).toStrictEqual([2, 3]);
300297});
301298});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。