Skip to content

Commit 4ef027f

Browse files
test(tools): add effectiveContextSize to the llm mock (fixes CI test gate)
tools.ts:323 calls llm.effectiveContextSize() to budget tool schemas to the context window, but tools-stream.test.ts mocked ../llm with only { init, streamChat } - so all 13 tests threw "effectiveContextSize is not a function". Add it to the mock (returns a roomy 8192 so budgeting takes its normal no-prune path). This is CI's hard gate (npm test); lint stays advisory in ci.yml. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U2S44L2JTARo75RQNRXH54
1 parent 81509ff commit 4ef027f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/__tests__/tools-stream.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const { streamChatMock, initMock } = vi.hoisted(() => ({
99
streamChatMock: vi.fn(),
1010
initMock: vi.fn().mockResolvedValue(undefined),
1111
}));
12-
vi.mock('../llm', () => ({ llm: { init: initMock, streamChat: streamChatMock } }));
12+
// effectiveContextSize() is called by toolChat to budget tool schemas to the window.
13+
// Return a roomy fixed size so budgeting takes its normal (no-prune) path under test.
14+
vi.mock('../llm', () => ({ llm: { init: initMock, streamChat: streamChatMock, effectiveContextSize: () => 8192 } }));
1315
const { getSettingMock, saveSettingMock } = vi.hoisted(() => ({ getSettingMock: vi.fn(() => [] as string[]), saveSettingMock: vi.fn() }));
1416
vi.mock('../database', () => ({ getSetting: getSettingMock, saveSetting: saveSettingMock }));
1517

0 commit comments

Comments
 (0)