pic.test.ts

623 B · typescript · 11 lines

1import { describe, expect, test } from "bun:test";2import { themed } from "./pic.ts";34describe("pic", () => {5  test("a pair is one picture: the dark webp in the source, the light webp in the img", () => {6    expect(themed({ dark: "/figures/spin-dark.webp", light: "/figures/spin-light.webp" }, "Spin", "avatar", " loading=\"lazy\"")).toBe(7      '<picture><source data-dark srcset="/figures/spin-dark.webp" media="screen and (prefers-color-scheme: dark)" type="image/webp">' +8        '<img class="avatar" src="/figures/spin-light.webp" alt="Spin" width="1024" height="1024" loading="lazy"></picture>',9    );10  });11});