import { expect, test } from "bun:test" import { brokenImage } from "./broken-image" import { checkSource } from "./support/check-source" test.each([ ['photo', "a.tsx", 1], ['', "a.tsx", 1], ['', "a.tsx", 0], ['', "a.tsx", 0], ['', "a.tsx", 0], ['', "a.tsx", 1], ['const example = "";', "a.tsx", 0], ['', "a.vue", 0], ['', "a.vue", 0], ["", "a.svelte", 0], ['', "a.astro", 1], ["// Plain comment\nexport const A=()=> ;", "a.tsx", 0], ['
{""}
', "a.tsx", 0], ['const pattern=//;', "a.tsx", 0], ['
{url ? : }
', "a.tsx", 1], ])("#given image source %s #then returns expected findings", (source, path, count) => { expect(checkSource(brokenImage, source, { path })).toHaveLength(count) }) test("#given a multiline missing image #then identifies its opening position", () => { expect(checkSource(brokenImage, "\n ")[0]).toMatchObject({ line: 2, column: 3 }) })