style(test): biome format

This commit is contained in:
Peter Steinberger
2025-12-12 18:07:33 +00:00
parent 37eaa49e4c
commit 9ea697ac09
2 changed files with 55 additions and 44 deletions

View File

@@ -481,52 +481,60 @@ describe("gateway server", () => {
await server.close(); await server.close();
}); });
test("agent ack response then final response", { timeout: 8000 }, async () => { test(
const { server, ws } = await startServerWithClient(); "agent ack response then final response",
ws.send( { timeout: 8000 },
JSON.stringify({ async () => {
type: "hello", const { server, ws } = await startServerWithClient();
minProtocol: 1, ws.send(
maxProtocol: 1, JSON.stringify({
client: { type: "hello",
name: "test", minProtocol: 1,
version: "1.0.0", maxProtocol: 1,
platform: "test", client: {
mode: "test", name: "test",
}, version: "1.0.0",
caps: [], platform: "test",
}), mode: "test",
); },
await onceMessage(ws, (o) => o.type === "hello-ok"); caps: [],
}),
);
await onceMessage(ws, (o) => o.type === "hello-ok");
const ackP = onceMessage( const ackP = onceMessage(
ws, ws,
(o) => (o) =>
o.type === "res" && o.id === "ag1" && o.payload?.status === "accepted", o.type === "res" &&
); o.id === "ag1" &&
const finalP = onceMessage( o.payload?.status === "accepted",
ws, );
(o) => const finalP = onceMessage(
o.type === "res" && o.id === "ag1" && o.payload?.status !== "accepted", ws,
); (o) =>
ws.send( o.type === "res" &&
JSON.stringify({ o.id === "ag1" &&
type: "req", o.payload?.status !== "accepted",
id: "ag1", );
method: "agent", ws.send(
params: { message: "hi", idempotencyKey: "idem-ag" }, JSON.stringify({
}), type: "req",
); id: "ag1",
method: "agent",
params: { message: "hi", idempotencyKey: "idem-ag" },
}),
);
const ack = await ackP; const ack = await ackP;
const final = await finalP; const final = await finalP;
expect(ack.payload.runId).toBeDefined(); expect(ack.payload.runId).toBeDefined();
expect(final.payload.runId).toBe(ack.payload.runId); expect(final.payload.runId).toBe(ack.payload.runId);
expect(final.payload.status).toBe("ok"); expect(final.payload.status).toBe("ok");
ws.close(); ws.close();
await server.close(); await server.close();
}); },
);
test( test(
"agent dedupes by idempotencyKey after completion", "agent dedupes by idempotencyKey after completion",

View File

@@ -74,7 +74,10 @@ describe("tau-rpc", () => {
expect(writes.length).toBeGreaterThan(0); expect(writes.length).toBeGreaterThan(0);
const first = writes[0]?.trim(); const first = writes[0]?.trim();
expect(first?.endsWith("\n")).toBe(false); expect(first?.endsWith("\n")).toBe(false);
const obj = JSON.parse(first ?? "{}") as { type?: string; message?: unknown }; const obj = JSON.parse(first ?? "{}") as {
type?: string;
message?: unknown;
};
expect(obj.type).toBe("prompt"); expect(obj.type).toBe("prompt");
expect(obj.message).toBe("hello"); expect(obj.message).toBe("hello");
}); });