test: align embedded teardown regression harness

This commit is contained in:
Frank Yang
2026-04-03 16:57:20 +08:00
parent 5267e0da74
commit 52b3bb46bb
2 changed files with 8 additions and 1 deletions

View File

@@ -257,7 +257,13 @@ describe("runEmbeddedAttempt context engine sessionKey forwarding", () => {
hoisted.acquireSessionWriteLockMock.mockResolvedValue({
release: releaseMock,
});
hoisted.flushPendingToolResultsAfterIdleMock.mockRejectedValueOnce(new Error("flush failed"));
let flushCallCount = 0;
hoisted.flushPendingToolResultsAfterIdleMock.mockImplementation(async () => {
flushCallCount += 1;
if (flushCallCount >= 2) {
throw new Error("flush failed");
}
});
const result = await createContextEngineAttemptRunner({
contextEngine: {

View File

@@ -157,6 +157,7 @@ vi.mock("../google.js", () => ({
logToolSchemasForGoogle: () => {},
sanitizeSessionHistory: async ({ messages }: { messages: unknown[] }) => messages,
sanitizeToolsForGoogle: ({ tools }: { tools: unknown[] }) => tools,
validateReplayTurns: async ({ messages }: { messages: unknown[] }) => messages,
}));
vi.mock("../../session-file-repair.js", () => ({