Four counts, each one work somebody has to do today: failed injections, licences expiring inside 14 days, past-due subscriptions, and purchases unlinked for more than 48 hours. No totals and no revenue -- nothing that cannot be acted on. Every row links straight to the thing that needs doing. An empty queue says "nothing to do here" rather than rendering a bare zero, so a quiet dashboard reads as quiet rather than broken. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { Queue } from "./Queue";
|
|
|
|
describe("Queue", () => {
|
|
it("shows the count and links every row to the work", () => {
|
|
render(
|
|
<Queue
|
|
title="Failed injections"
|
|
tone="expired"
|
|
count={2}
|
|
items={[
|
|
{ label: "Acme Production", href: "/staff/instances/i1", meta: "4h ago" },
|
|
{ label: "Globex EU", href: "/staff/instances/i2", meta: "26m ago" },
|
|
]}
|
|
/>,
|
|
);
|
|
expect(screen.getByText("Failed injections")).toBeInTheDocument();
|
|
expect(screen.getByText("2")).toBeInTheDocument();
|
|
expect(screen.getByRole("link", { name: "Acme Production" })).toHaveAttribute(
|
|
"href",
|
|
"/staff/instances/i1",
|
|
);
|
|
});
|
|
|
|
it("says so plainly when there is nothing to do", () => {
|
|
render(<Queue title="Past due" tone="expired" count={0} items={[]} />);
|
|
expect(screen.getByText(/nothing to do/i)).toBeInTheDocument();
|
|
});
|
|
});
|