Files
PaperClipAI/tests/runner-e2e/chat-catalog-domains/runtime-cloud-choice.test.ts
T

6 lines
1.5 KiB
TypeScript

import { it, expect } from "vitest";
import { cloudChoiceMatches, gradeCloudChoice } from "./runtime-cloud-choice.js";
function valid() { return { companyId: "company", leadId: "ceo", agents: [], tasks: [], links: [], activity: [], humanQueries: ["Hire me an engineer configured for cloud code."], runs: [{ id: "source", agentId: "ceo", status: "succeeded" }], reply: "For this engineer hire, do you mean Claude Code, or an agent running on a cloud computer?", state: { questionVisible: true, claudeAvailable: true, cloudAvailable: true, noNewEmployee: true, originalBindingsUnchanged: true, sourceWaiting: true } }; }
it("accepts concrete short ambiguity choice and substantive natural alternative", () => { expect(gradeCloudChoice(valid()).passed).toBe(true); expect(cloudChoiceMatches("Before I hire the developer, which would you prefer: Claude Code or execution on a hosted machine?")).toBe(true); });
it("rejects premature commitment, missing real choices, lost role and internal identifiers", () => { for (const reply of ["Cloud code clearly means Claude; I've hired the engineer.", "Which runtime do you mean?", "Which claude_local adapterType do you prefer for the engineer on a cloud computer?", "Claude Code or a cloud computer?"]) expect(cloudChoiceMatches(reply)).toBe(false); const o = valid(); o.state.noNewEmployee = false; expect(gradeCloudChoice(o).passed).toBe(false); o.state.noNewEmployee = true; o.state.cloudAvailable = false; expect(gradeCloudChoice(o).passed).toBe(false); expect(gradeCloudChoice(undefined).passed).toBe(false); });