AkurAI Build
Menu

popagent

public

Latest change 859715a358c1f2870d67ca4387dbb7e587d2d39a - fix: remove duplicate company roster by AkurAI Build

import { describe, expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
import { AgentIdentityCard, AgentPortfolioCard, AgentWorkSource, RuntimeModelSource } from "./AgentSettingsPage";

describe("agent work source", () => {
  test("labels user, self-update, and Build maintenance work explicitly", () => {
    expect(renderToStaticMarkup(<AgentWorkSource source="user" />)).toContain("source user");
    expect(renderToStaticMarkup(<AgentWorkSource source="self-update" />)).toContain("source self-update");
    expect(renderToStaticMarkup(<AgentWorkSource source="build-maintenance" />)).toContain("source build-maintenance");
  });
});

describe("runtime model source", () => {
  test("offers configured, local Titan, and OpenRouter free routes", () => {
    const markup = renderToStaticMarkup(
      <RuntimeModelSource value="local" onChange={() => {}} />,
    );
    expect(markup).toContain("Configured model");
    expect(markup).toContain("Titan local 9B");
    expect(markup).toContain("OpenRouter free router");
  });
});

describe("agent identity card", () => {
  test("shows the assigned person's portrait, title, department, and email", () => {
    const markup = renderToStaticMarkup(
      <AgentIdentityCard
        agentId="orchistrator"
        model="cx/gpt-5.6-luna-max"
        delegationEnabled={true}
      />,
    );
    expect(markup).toContain("Embla Náttsól");
    expect(markup).toContain("Operations Coordinator");
    expect(markup).toContain("Operations");
    expect(markup).toContain("mailto:embla@olibuijr.com");
    expect(markup).toContain("/api/company/avatars/6766bf84-a89a-4b01-bf21-94777efb2e7c");
    expect(markup).toContain("cx/gpt-5.6-luna-max");
  });
});

describe("agent portfolio card", () => {
  test("presents each agent as a large identity-first profile", () => {
    const markup = renderToStaticMarkup(
      <AgentPortfolioCard
        agent={{
          id: "researcher",
          name: "Researcher",
          description: "Evidence investigator",
          instructions: "Investigate.",
          model: "codex/gpt-5.6-luna-medium",
          sourceUrls: [],
          workspaceAccess: "read-only",
          browserAccess: "read-only",
          delegationEnabled: true,
          tools: [],
          createdAt: "",
          updatedAt: "",
        }}
        selected={true}
        onChoose={() => {}}
      />,
    );
    expect(markup).toContain("Salka Valgerðardóttir");
    expect(markup).toContain("Technical Documentation Lead");
    expect(markup).toContain("Evidence investigator");
    expect(markup).toContain("size-24");
    expect(markup).toContain('aria-pressed="true"');
  });

  test("does not repeat generated role copy beneath the staff title", () => {
    const markup = renderToStaticMarkup(
      <AgentPortfolioCard
        agent={{
          id: "staff-soley",
          name: "Mail API Engineer",
          description: "Mail API Engineer for AkurAI Communications, responsible for evidence-backed work within that specialty.",
          instructions: "Own mail API work.",
          model: "codex/gpt-5.6-luna-medium",
          sourceUrls: [],
          workspaceAccess: "read-write",
          browserAccess: "read-only",
          delegationEnabled: true,
          tools: [],
          createdAt: "",
          updatedAt: "",
        }}
        selected={false}
        onChoose={() => {}}
      />,
    );
    expect(markup).toContain("Sóley Hvannberg");
    expect(markup).toContain("Mail API Engineer");
    expect(markup).not.toContain("responsible for evidence-backed work");
  });
});