Skip to content

Commit 6c4e06c

Browse files
committed
test: speed up sanitize session history coverage
1 parent 0affaf1 commit 6c4e06c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/agents/pi-embedded-runner.sanitize-session-history.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AgentMessage } from "@mariozechner/pi-agent-core";
22
import type { AssistantMessage, UserMessage, Usage } from "@mariozechner/pi-ai";
3-
import { beforeEach, describe, expect, it, vi } from "vitest";
3+
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
44
import {
55
expectOpenAIResponsesStrictSanitizeCall,
66
loadSanitizeSessionHistoryWithCleanMocks,
@@ -252,11 +252,16 @@ describe("sanitizeSessionHistory", () => {
252252
| undefined;
253253
};
254254

255-
beforeEach(async () => {
256-
testTimestamp = 1;
255+
beforeAll(async () => {
257256
const harness = await loadSanitizeSessionHistoryWithCleanMocks();
258257
sanitizeSessionHistory = harness.sanitizeSessionHistory;
259258
mockedHelpers = harness.mockedHelpers;
259+
});
260+
261+
beforeEach(() => {
262+
testTimestamp = 1;
263+
vi.clearAllMocks();
264+
vi.mocked(mockedHelpers.sanitizeSessionMessagesImages).mockImplementation(async (msgs) => msgs);
260265
mockSessionManager = makeMockSessionManager();
261266
});
262267

0 commit comments

Comments
 (0)