import { it, expect } from "vitest"; import { gradeConference } from "./runtime-conference.js"; function valid() { return { scenarioId: "agent-chat.conference-room", companyId: "company", leadId: "ceo", reply: "Open the Conference Room for the separate board-level discussion.", state: { deploymentMode: "local_trusted", conferenceEnabled: true, agentChatEnabled: true, conferenceLinkClicked: true, conferenceVisible: true, openedCompanyPrefix: "ACORN", companyPrefix: "ACORN", noBrokenRoute: true, runsBeforeOpen: 1, runsAfterOpen: 1, standingIssueBefore: "chat", standingIssueAfter: "chat" } as Record, agents: [], tasks: [], links: ["/ACORN/board-chat"], activity: [], runs: [], humanQueries: [] }; } it("accepts the real gated board surface in company context", () => expect(gradeConference(valid()).passed).toBe(true)); it("does not depend on how the reply words the surface", () => { const o = valid(); o.reply = "Sure, the launch talk can happen over there: [Conference Room](/ACORN/board-chat). A different assistant answers in that room and it starts fresh."; expect(gradeConference(o).passed).toBe(true); }); it("rejects missing conference evidence", () => expect(gradeConference(undefined).passed).toBe(false)); it("rejects wrong deployment qualification", () => { const o = valid(); o.state.deploymentMode = "authenticated"; expect(gradeConference(o).passed).toBe(false); }); it("rejects navigation to another company", () => { const o = valid(); o.state.openedCompanyPrefix = "BIRCH"; expect(gradeConference(o).passed).toBe(false); }); it("rejects hidden execution started by opening the surface", () => { const o = valid(); o.state.runsAfterOpen = 2; expect(gradeConference(o).passed).toBe(false); }); it("preserves failure when the actual model only asks launch questions and renders no Conference Room link", () => { const o = valid(); o.reply = "Ready. What are we launching, and what is the target date?"; o.links = []; o.state = { deploymentMode: "local_trusted", conferenceEnabled: true, agentChatEnabled: true, conferenceLinkClicked: false, companyPrefix: "ACORN", runsBeforeOpen: 1, standingIssueBefore: "chat" }; expect(gradeConference(o).passed).toBe(false); });