Skip to content

The open-source app everyone uses to manage agents at work

1.2 KB
Raw Blame
import { describe, expect, it } from "vitest";
import { computeComposerHandoffPreview } from "../lib/interrupt-handoff";
import { shouldRenderComposerHandoffPreview } from "./IssueChatThread";

describe("shouldRenderComposerHandoffPreview", () => {
  it("skips the spacer wrapper when the preview is empty", () => {
    const preview = computeComposerHandoffPreview({
      reassignTarget: "agent:agent-claude",
      currentAssigneeValue: "agent:agent-claude",
      hasActiveRun: true,
      bodyHasAgentMention: false,
      plainNameCandidate: null,
    });

    expect(preview.kind).toBe("none");
    expect(shouldRenderComposerHandoffPreview("Wake Claude", preview)).toBe(false);
  });

  it("renders the spacer wrapper only when body text and a visible preview are present", () => {
    const preview = computeComposerHandoffPreview({
      reassignTarget: "agent:agent-qa",
      currentAssigneeValue: "agent:agent-claude",
      hasActiveRun: true,
      bodyHasAgentMention: false,
      plainNameCandidate: null,
    });

    expect(preview.kind).not.toBe("none");
    expect(shouldRenderComposerHandoffPreview("Wake QA", preview)).toBe(true);
    expect(shouldRenderComposerHandoffPreview("   ", preview)).toBe(false);
  });
});