import { describe, it, expect } from "vitest"; import { render } from "@testing-library/react"; import { Sparkline } from "../../src/components/Sparkline"; describe("sparkline evidence", () => { it("draws isolated measured zeros and dashed bridges, without changing the input", () => { const values = [null, 0, null, 4, 5, null]; const { container } = render(); expect(container.querySelectorAll("[data-gap]")).toHaveLength(1); expect(container.querySelector("[data-gap]")).toHaveAttribute("stroke-dasharray", "3 3"); expect(container.querySelectorAll("[data-sample]")).toHaveLength(1); expect(values).toEqual([null, 0, null, 4, 5, null]); }); it("marks a long time gap and a single reading, without extrapolating measured points", () => { const { container, rerender } = render(); expect(container.querySelectorAll("[data-gap]")).toHaveLength(1); rerender(); expect(container.querySelectorAll("[data-sample]")).toHaveLength(1); expect(container.querySelectorAll("[data-gap]")).toHaveLength(0); }); });