test: import vi in gateway chat server test

This commit is contained in:
Peter Steinberger
2026-03-22 23:17:05 +00:00
parent 4f11982ae6
commit 6245b4f3d8

View File

@@ -1,8 +1,9 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, test } from "vitest";
import { describe, expect, test, vi } from "vitest";
import { WebSocket } from "ws";
import type { GetReplyOptions } from "../auto-reply/types.js";
import { emitAgentEvent, registerAgentRunContext } from "../infra/agent-events.js";
import { extractFirstTextBlock } from "../shared/chat-message-content.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
@@ -166,7 +167,7 @@ describe("gateway server chat", () => {
releaseBlockedReply = resolve;
});
const replySpy = vi.mocked(getReplyFromConfig);
replySpy.mockImplementationOnce(async (_ctx, opts) => {
replySpy.mockImplementationOnce(async (_ctx: unknown, opts?: GetReplyOptions) => {
await new Promise<void>((resolve) => {
let settled = false;
const finish = () => {
@@ -620,7 +621,7 @@ describe("gateway server chat", () => {
test("routes block-streamed /btw replies through side-result events", async () => {
await withMainSessionStore(async () => {
const replyMock = vi.mocked(getReplyFromConfig);
replyMock.mockImplementationOnce(async (_ctx, opts) => {
replyMock.mockImplementationOnce(async (_ctx: unknown, opts?: GetReplyOptions) => {
await opts?.onBlockReply?.({
text: "first chunk",
btw: { question: "what changed?" },