Skip to content

The platform for continuously improving AI agents.

895 B
Raw Blame
// @vitest-environment jsdom
// covers: console-logic
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, expect, it } from "vitest";

import { RunStatus } from "./run-status";

afterEach(cleanup);

it("uses the recorded completion time", () => {
  render(
    <RunStatus completedAt="2026-12-02T12:03:00Z" phase="done" startedAt="2026-12-02T12:00:00Z" />
  );
  expect(screen.getAllByText("Done in 3 min").length).toBeGreaterThan(0);
});

it.each([
  ["blocked", "Blocked"],
  ["cancelled", "Cancelled"],
  ["unmet", "Incomplete"],
  ["exhausted", "Limit reached"],
  ["idle", "Not running"],
] as const)("does not present %s work as running", (phase, label) => {
  render(<RunStatus phase={phase} startedAt="2026-12-02T12:00:00Z" />);
  expect(screen.getAllByText(label).length).toBeGreaterThan(0);
  expect(screen.queryByText(/Running for/)).toBeNull();
});