summaryrefslogtreecommitdiffhomepage
path: root/packages/api/tests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/api/tests')
-rw-r--r--packages/api/tests/agent-manager.test.ts15
-rw-r--r--packages/api/tests/routes.test.ts15
2 files changed, 28 insertions, 2 deletions
diff --git a/packages/api/tests/agent-manager.test.ts b/packages/api/tests/agent-manager.test.ts
index a1f2d75..28fa044 100644
--- a/packages/api/tests/agent-manager.test.ts
+++ b/packages/api/tests/agent-manager.test.ts
@@ -13,7 +13,10 @@ vi.mock("@dispatch/core", () => ({
yield { type: "text-delta", delta: "world" } as const;
yield {
type: "done",
- message: { role: "assistant", content: "Hello world" },
+ message: {
+ role: "assistant",
+ chunks: [{ type: "text", text: "Hello world" }],
+ },
} as const;
yield { type: "status", status: "idle" } as const;
}
@@ -178,6 +181,16 @@ vi.mock("@dispatch/core", () => ({
return null;
},
appendMessage() {},
+ updateMessage() {},
+ getMessagesForTab() {
+ return [];
+ },
+ appendEventToChunks(_chunks: unknown[], _event: unknown) {
+ // no-op stub; chunk accumulation isn't exercised in these unit tests
+ },
+ applySystemEvent(_messages: unknown[], _event: unknown) {
+ return { messageId: "mock-system-msg" };
+ },
BackgroundShellStore: class MockBackgroundShellStore {
has() {
return false;
diff --git a/packages/api/tests/routes.test.ts b/packages/api/tests/routes.test.ts
index 69a6676..49bae49 100644
--- a/packages/api/tests/routes.test.ts
+++ b/packages/api/tests/routes.test.ts
@@ -14,7 +14,10 @@ vi.mock("@dispatch/core", () => ({
yield { type: "text-delta", delta: "world" } as const;
yield {
type: "done",
- message: { role: "assistant", content: "Hello world" },
+ message: {
+ role: "assistant",
+ chunks: [{ type: "text", text: "Hello world" }],
+ },
} as const;
yield { type: "status", status: "idle" } as const;
}
@@ -179,6 +182,16 @@ vi.mock("@dispatch/core", () => ({
return null;
},
appendMessage() {},
+ updateMessage() {},
+ getMessagesForTab() {
+ return [];
+ },
+ appendEventToChunks(_chunks: unknown[], _event: unknown) {
+ // no-op stub
+ },
+ applySystemEvent(_messages: unknown[], _event: unknown) {
+ return { messageId: "mock-system-msg" };
+ },
BackgroundShellStore: class MockBackgroundShellStore {
has() {
return false;