mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:38:39 +00:00
test: align chat abort helpers with gateway handler types
This commit is contained in:
@@ -197,7 +197,7 @@ describe("chat abort transcript persistence", () => {
|
|||||||
const { transcriptPath, sessionId } = await createTranscriptFixture("openclaw-chat-stop-");
|
const { transcriptPath, sessionId } = await createTranscriptFixture("openclaw-chat-stop-");
|
||||||
const respond = vi.fn();
|
const respond = vi.fn();
|
||||||
const context = createChatAbortContext({
|
const context = createChatAbortContext({
|
||||||
chatAbortControllers: new Map([["run-stop-1", createActiveRun("main", sessionId)]]),
|
chatAbortControllers: new Map([["run-stop-1", createActiveRun("main", { sessionId })]]),
|
||||||
chatRunBuffers: new Map([["run-stop-1", "Partial from /stop"]]),
|
chatRunBuffers: new Map([["run-stop-1", "Partial from /stop"]]),
|
||||||
chatDeltaSentAt: new Map([["run-stop-1", Date.now()]]),
|
chatDeltaSentAt: new Map([["run-stop-1", Date.now()]]),
|
||||||
removeChatRun: vi.fn().mockReturnValue({ sessionKey: "main", clientRunId: "client-stop-1" }),
|
removeChatRun: vi.fn().mockReturnValue({ sessionKey: "main", clientRunId: "client-stop-1" }),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
|
import type { GatewayRequestHandler } from "./types.js";
|
||||||
|
|
||||||
export function createActiveRun(
|
export function createActiveRun(
|
||||||
sessionKey: string,
|
sessionKey: string,
|
||||||
@@ -37,14 +38,7 @@ export function createChatAbortContext(overrides: Record<string, unknown> = {})
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function invokeChatAbortHandler(params: {
|
export async function invokeChatAbortHandler(params: {
|
||||||
handler: (args: {
|
handler: GatewayRequestHandler;
|
||||||
params: { sessionKey: string; runId?: string };
|
|
||||||
respond: never;
|
|
||||||
context: never;
|
|
||||||
req: never;
|
|
||||||
client: never;
|
|
||||||
isWebchatConnect: () => boolean;
|
|
||||||
}) => Promise<void>;
|
|
||||||
context: ReturnType<typeof createChatAbortContext>;
|
context: ReturnType<typeof createChatAbortContext>;
|
||||||
request: { sessionKey: string; runId?: string };
|
request: { sessionKey: string; runId?: string };
|
||||||
client?: {
|
client?: {
|
||||||
|
|||||||
Reference in New Issue
Block a user