import { describe, it, expect, vi } from "vitest"; import { render, screen } from "@testing-library/react"; import { AgentsOverviewBar } from "../AgentsOverviewBar"; import type { Agent } from "../../api"; vi.mock("lucide-react", async () => { const actual = await vi.importActual("lucide-react"); return { ...actual, ChevronDown: () => , ChevronRight: () => , }; }); vi.mock("../AgentMetricsBar", () => ({ AgentMetricsBar: () =>
, })); vi.mock("../ActiveAgentsPanel", () => ({ ActiveAgentsPanel: () => , })); function makeAgent(id: string, state: Agent["state"]): Agent { return { id, name: id, role: "executor", state, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), metadata: {}, }; } describe("AgentsOverviewBar", () => { it("counts active and running states separately in the meta label", () => { // Three in 'active' (idle/enabled) and one in 'running' (mid-heartbeat). // The label must reflect the distinction — previously both buckets were // displayed under "running", which was misleading when only some were // actually executing. const agents = [ makeAgent("a-1", "active"), makeAgent("a-2", "active"), makeAgent("a-3", "active"), makeAgent("a-4", "running"), ]; render(