import { render, screen } from "@testing-library/react"; import CoverageNotice from "./CoverageNotice"; import { formatTime } from "./format"; const WATERMARK = 1_700_000_000; test("a window the log covers in full says nothing", () => { const { container } = render(); expect(container.textContent).toBe(""); }); test("a window reaching past the watermark names the instant history starts", () => { render(); const notice = screen.getByRole("status"); expect(notice.textContent).toContain("Query history is available from"); expect(notice.textContent).toContain(formatTime(WATERMARK)); }); /** * The server judges completeness, not the page: an unbounded request is * incomplete whatever the watermark reads, and the notice must follow that * verdict rather than compare timestamps itself. */ test("the server's verdict decides, not the numbers beside it", () => { const { rerender, container } = render( , ); expect(container.textContent).toBe(""); rerender(); expect(screen.getByRole("status").textContent).toContain(formatTime(0)); });