Files
dev/third_party/pi/packages/coding-agent/test/rpc-client-clear-queue.test.ts
alexion 4def357d09 chore(vendor): import pi 0.85.1
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
2026-09-14 10:48:47 -04:00

30 lines
974 B
TypeScript

import { describe, expect, it, vi } from "vitest";
import { RpcClient } from "../src/modes/rpc/rpc-client.ts";
type RpcClientPrivate = {
send: (command: { type: string }) => Promise<unknown>;
getData: <T>(response: unknown) => T;
};
describe("RpcClient clearQueue", () => {
it("sends the clear_queue RPC command", async () => {
const client = new RpcClient();
const privateClient = client as unknown as RpcClientPrivate;
const send = vi.fn(async () => ({
type: "response",
command: "clear_queue",
success: true,
data: { steering: ["Change direction"], followUp: ["Summarize when finished"] },
}));
privateClient.send = send;
privateClient.getData = <T>(response: unknown): T => {
return (response as { data: T }).data;
};
const result = await client.clearQueue();
expect(send).toHaveBeenCalledWith({ type: "clear_queue" });
expect(result).toEqual({ steering: ["Change direction"], followUp: ["Summarize when finished"] });
});
});