Skip to content

Commit 1cd6f81

Browse files
committed
fix: close memory test failure paths
1 parent 80c754d commit 1cd6f81

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

extensions/memory-core/src/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ describe("memory cli", () => {
23422342
lastRecalledAt: "<now>",
23432343
queryHashes: ["<hash>"],
23442344
recallDays: ["<today>"],
2345-
conceptTags: ["backup", "backups", "glacier"],
2345+
conceptTags: ["backup", "backups", "glacier", "s3"],
23462346
});
23472347
expect(close).toHaveBeenCalled();
23482348
});

extensions/memory-core/src/memory/manager.sync-errors-do-not-crash.test.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ describe("memory manager sync failures", () => {
1717
unhandled.push(reason);
1818
};
1919
process.on("unhandledRejection", handler);
20-
const syncSpy = vi
21-
.fn()
22-
.mockRejectedValueOnce(new Error("openai embeddings failed: 400 bad request"));
23-
setTimeout(() => {
24-
runDetachedMemorySync(syncSpy, "watch");
25-
}, 1);
20+
try {
21+
const syncSpy = vi
22+
.fn()
23+
.mockRejectedValueOnce(new Error("openai embeddings failed: 400 bad request"));
24+
setTimeout(() => {
25+
runDetachedMemorySync(syncSpy, "watch");
26+
}, 1);
2627

27-
await vi.runOnlyPendingTimersAsync();
28-
vi.useRealTimers();
29-
await syncSpy.mock.results[0]?.value?.catch(() => undefined);
28+
await vi.runOnlyPendingTimersAsync();
29+
vi.useRealTimers();
30+
await syncSpy.mock.results[0]?.value?.catch(() => undefined);
3031

31-
process.off("unhandledRejection", handler);
32-
expect(unhandled).toHaveLength(0);
32+
expect(unhandled).toHaveLength(0);
33+
} finally {
34+
process.off("unhandledRejection", handler);
35+
}
3336
});
3437
});

0 commit comments

Comments
 (0)