mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-09 08:11:09 +00:00
test: import vi in gateway chat server test
This commit is contained in:
@@ -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?" },
|
||||
|
||||
Reference in New Issue
Block a user