mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 09:02:15 +00:00
Merged via squash.
Prepared head SHA: fcabdf7c31
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
24 lines
696 B
TypeScript
24 lines
696 B
TypeScript
import type { AgentSideConnection } from "@agentclientprotocol/sdk";
|
|
import { vi } from "vitest";
|
|
import type { GatewayClient } from "../gateway/client.js";
|
|
|
|
export type TestAcpConnection = AgentSideConnection & {
|
|
__sessionUpdateMock: ReturnType<typeof vi.fn>;
|
|
};
|
|
|
|
export function createAcpConnection(): TestAcpConnection {
|
|
const sessionUpdate = vi.fn(async () => {});
|
|
return {
|
|
sessionUpdate,
|
|
__sessionUpdateMock: sessionUpdate,
|
|
} as unknown as TestAcpConnection;
|
|
}
|
|
|
|
export function createAcpGateway(
|
|
request: GatewayClient["request"] = vi.fn(async () => ({ ok: true })) as GatewayClient["request"],
|
|
): GatewayClient {
|
|
return {
|
|
request,
|
|
} as unknown as GatewayClient;
|
|
}
|