AkurAI Build
Menu

popagent

public

Latest change 7f6c1d0ed24ffc264e50e9966eaf45024245ba71 - feat: add per-task agent communication by AkurAI Build

import { describe, expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
import type { ChannelMessage } from "../api-types";
import { ChannelMessageCard } from "./ChannelPage";

const communication: ChannelMessage = {
  id: "message-2",
  channelId: "general",
  workspaceId: "default",
  authorId: "reviewer",
  authorName: "Reviewer",
  content: "The boundary is contained.",
  taskId: null,
  task: null,
  agentCommunication: {
    taskId: "task-1",
    fromAgentId: "reviewer",
    toAgentId: "researcher",
    toAgentName: "Researcher",
    replyToMessageId: "message-1",
  },
  createdAt: "2026-08-16T12:00:00.000Z",
};

describe("ChannelMessageCard", () => {
  test("renders agent and company identities with an accessible reply relation", () => {
    const html = renderToStaticMarkup(
      <ChannelMessageCard
        message={communication}
        agentName="Orchistrator"
        mode="timeline"
        onCancel={() => undefined}
      />,
    );
    expect(html).toContain("Freyja");
    expect(html).toContain("Reviewer");
    expect(html).toContain("Researcher");
    expect(html).toContain("Salka");
    expect(html).toContain("Reply to message message-1");
    expect(html).toContain('aria-label="Message from Reviewer to Researcher"');
    expect(html.match(/<img/g)).toHaveLength(2);
  });
});