Skip to content

The platform for continuously improving AI agents.

651 B
Raw Blame
// @vitest-environment jsdom
// covers: measured-facts
import { cleanup, render } from "@testing-library/react";
import { afterEach, expect, it } from "vitest";

import { CostComparison } from "./cost-comparison";

afterEach(cleanup);

it.each([
  [undefined, undefined, "Estimate unavailable"],
  [0, 0, "Estimate 0 credits (no change)"],
  [100, 25, "Estimate 100 credits (+25 credits)"],
  [100, -25, "Estimate 100 credits (−25 credits)"],
])("shows the estimate and signed difference", (cost, delta, expected) => {
  const { container } = render(<CostComparison cost={cost} delta={delta} />);
  expect(container.textContent).toBe(expected);
});