Elffuss BraidHub

kikocis/continue public

fix: more tests
Changeset4a39a1d9bb27cb425d3fa08ffbb478fb870dc4810b4c706ad0db1fab3d41ad60
AuthorNate <sestinj@gmail.com> · 2025-08-23 10:57 -07:00
CommitterNate <sestinj@gmail.com> · 2025-08-23 10:57 -07:00
Parentsa84925a02003

Browse the files at this changeset

3 files changed

modified extensions/cli/src/compaction.infiniteLoop.test.ts +8 −8
@@ -1,7 +1,7 @@
1-import { ChatCompletionMessageParam } from "openai/resources.mjs";
2-import { describe, it, expect, vi } from "vitest";
31 import { ModelConfig } from "@continuedev/config-yaml";
42 import { BaseLlmApi } from "@continuedev/openai-adapters";
3+import { ChatCompletionMessageParam } from "openai/resources.mjs";
4+import { describe, it, expect, vi } from "vitest";
55
66 import { compactChatHistory } from "./compaction.js";
77 import { streamChatResponse } from "./streamChatResponse.js";
@@ -43,7 +43,7 @@
4343 mockStreamResponse.mockImplementation(
4444 async (history, model, api, controller, callbacks) => {
4545 callbacks?.onContent?.("Summary");
46- callbacks?.onContentComplete?.();
46+ callbacks?.onContentComplete?.("Summary");
4747 return "Summary";
4848 },
4949 );
@@ -54,7 +54,7 @@
5454 ];
5555
5656 // This should not hang - it should break out of the loop
57- const result = await compactChatHistory(history, mockModel, mockLlmApi);
57+ const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
5858
5959 // Should complete successfully even though token count is still too high
6060 expect(result.compactedHistory).toBeDefined();
@@ -75,7 +75,7 @@
7575 mockStreamResponse.mockImplementation(
7676 async (history, model, api, controller, callbacks) => {
7777 callbacks?.onContent?.("Summary");
78- callbacks?.onContentComplete?.();
78+ callbacks?.onContentComplete?.("Summary");
7979 return "Summary";
8080 },
8181 );
@@ -88,7 +88,7 @@
8888 ];
8989
9090 // This should not hang
91- const result = await compactChatHistory(history, mockModel, mockLlmApi);
91+ const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
9292
9393 expect(result.compactedHistory).toBeDefined();
9494 });
@@ -116,7 +116,7 @@
116116 mockStreamResponse.mockImplementation(
117117 async (history, model, api, controller, callbacks) => {
118118 callbacks?.onContent?.("Summary");
119- callbacks?.onContentComplete?.();
119+ callbacks?.onContentComplete?.("Summary");
120120 return "Summary";
121121 },
122122 );
@@ -129,7 +129,7 @@
129129 { role: "user", content: "Another question" },
130130 ];
131131
132- const result = await compactChatHistory(history, mockModel, mockLlmApi);
132+ const result = await compactChatHistory(history, mockModel, mockLlmApi, {});
133133
134134 expect(result.compactedHistory).toBeDefined();
135135 // The function will call countTokens multiple times during the process
modified extensions/cli/src/test-helpers/ui-test-context.ts +1 −1
@@ -72,7 +72,7 @@
7272 responseStartTime: null,
7373 inputMode: true,
7474 attachedFiles: [],
75- handleUserMessage: vi.fn(),
75+ handleUserMessage: vi.fn().mockResolvedValue(undefined),
7676 handleInterrupt: vi.fn(),
7777 handleFileAttached: vi.fn(),
7878 resetChatHistory: vi.fn(),
modified extensions/cli/src/ui/hooks/useChat.helpers.ts +0 −4
@@ -291,10 +291,6 @@
291291 currentChatHistory: ChatCompletionMessageParam[];
292292 currentCompactionIndex: number | null;
293293 }> {
294- if (!llmApi) {
295- throw new Error("LLM API is not available for auto-compaction");
296- }
297-
298294 const { handleAutoCompaction: coreAutoCompaction } = await import(
299295 "../../streamChatResponse.autoCompaction.js"
300296 );