Files
PaperClipAI/ui/src/lib/bulk-agent-settings.test.ts
T
DottaandPaperclip 9bf7dc0c8f feat(agents): bulk edit connections and default models (#17215)
Add harness-scoped bulk connection and default-model edits to the agent roster, with compatible choices, change previews, per-agent save results, and retries.

Use an icon-based harness filter, keep agent rows readable, remove the status selector and selection hint, and redirect legacy status URLs to the full roster.

Preserve authorization, audit history, unrelated settings, and optimistic concurrency checks through the existing agent update route.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-22 18:47:06 -05:00

24 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { mapBulkAgents, sameBinding } from "./bulk-agent-settings";
describe("bulk agent writes", () => {
it("bounds concurrent requests and retains each success and failure in input order", async () => {
let active = 0;
let peak = 0;
const results = await mapBulkAgents([0, 1, 2, 3, 4, 5, 6], async id => {
active++;
peak = Math.max(peak, active);
await new Promise(resolve => setTimeout(resolve, id === 0 ? 15 : 1));
active--;
if (id === 2) throw new Error("Unavailable");
return id;
});
expect(peak).toBe(4);
expect(results.map(r => r.status === "fulfilled" ? r.value : "failed")).toEqual([0, 1, "failed", 3, 4, 5, 6]);
});
it("compares binding identity independently of JSON field order", () => {
expect(sameBinding({ provider: "openai", method: "api_key", mode: "responsible_user" }, { mode: "responsible_user", method: "api_key", provider: "openai" })).toBe(true);
expect(sameBinding(undefined, { mode: "responsible_user", method: "api_key", provider: "openai" })).toBe(false);
});
});