import { cleanup, render, screen, } from "@testing-library/react"; import assert from "node:assert"; import { afterEach, describe, test, } from "node:test"; import { Picture } from "./index"; describe("Picture", () => { afterEach(() => { cleanup(); }); test("renders source elements and image child", () => { const { container } = render( {"Preview"} ); const sources = container.querySelectorAll("source"); assert.strictEqual(sources.length, 2); assert.strictEqual(sources[0]?.getAttribute("media"), "(max-width: 767px)"); assert.notStrictEqual(screen.queryByRole("img", { name: "Preview" }), null); }); });