shoc-frontend-new/src/test/app/(protected)/workorders/reschedule-counter-pill.test.tsx

19 lines
894 B
TypeScript
Raw Normal View History

import { screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { RescheduleCounterPill } from "@/app/(protected)/workorders/_components/list/table/cells/wo-counter-pills";
import { renderWithProviders } from "@/test/test-utils";
describe("RescheduleCounterPill", () => {
it("hides the pill when the count is below 2", () => {
const { container } = renderWithProviders(<RescheduleCounterPill count={1} />);
expect(container).toBeEmptyDOMElement();
});
it("renders a purple count pill with history tooltip from originalDate", () => {
renderWithProviders(<RescheduleCounterPill count={4} originalDate="2026-05-08" />);
const pill = screen.getByLabelText(/Rescheduled 4 times.*Original date: May 8, 2026/i);
expect(pill).toHaveStyle({ background: "#f5f3ff", color: "#7c3aed" });
expect(pill).toHaveTextContent("4");
});
});