import { afterEach, expect, test } from "bun:test"; import { renderToString } from "react-dom/server"; import { LoadingLine, reducedMotion } from "../src"; const g = globalThis as Record; afterEach(() => { delete g.window; }); test("reducedMotion follows the media query and is false without a window", () => { expect(reducedMotion()).toBe(false); g.window = { matchMedia: (q: string) => ({ matches: q.includes("prefers-reduced-motion: reduce") }) }; expect(reducedMotion()).toBe(true); g.window = { matchMedia: () => ({ matches: false }) }; expect(reducedMotion()).toBe(false); }); test("LoadingLine renders nothing until its delay has passed (fast loads show no indicator)", () => { expect(renderToString()).toBe(""); });