


























@@ -11,6 +11,16 @@ import {
11111212const { createSessionStoreDir, openClient } = setupGatewaySessionsTestHarness();
131314+function collectNonEmptyLines(text: string): string[] {
15+const lines: string[] = [];
16+for (const line of text.split(/\r?\n/)) {
17+if (line.trim().length > 0) {
18+lines.push(line);
19+}
20+}
21+return lines;
22+}
23+1424test("lists and patches session store via sessions.* RPC", async () => {
1525const { dir, storePath } = await createSessionStoreDir();
1626const now = Date.now();
@@ -378,9 +388,9 @@ test("lists and patches session store via sessions.* RPC", async () => {
378388});
379389expect(compacted.ok).toBe(true);
380390expect(compacted.payload?.compacted).toBe(true);
381-const compactedLines = (await fs.readFile(path.join(dir, "sess-main.jsonl"), "utf-8"))
382-.split(/\r?\n/)
383- .filter((l) => l.trim().length > 0);
391+const compactedLines = collectNonEmptyLines(
392+await fs.readFile(path.join(dir, "sess-main.jsonl"), "utf-8"),
393+);
384394expect(compactedLines).toHaveLength(3);
385395const filesAfterCompact = await fs.readdir(dir);
386396expect(filesAfterCompact).toContainEqual(expect.stringMatching(/^sess-main\.jsonl\.bak\./));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。