import { expect, test } from "bun:test" import { insertAfterProlog } from "./probe-placement" const P = "" test.each([ ["a head", "t", `${P}t`], ["no head", "

x

", `${P}

x

`], ["only a doctype", "
h
", `${P}
h
`], ["no prolog", "
h

x

", `${P}
h

x

`], ["a inside a leading comment", "

x

", `${P}

x

`], ["a inside a later script string", "", `${P}`], ["a > inside a quoted attribute", 't', `${P}t`], ["a
where the head would be", "
h
", `${P}
h
`], ["a leading XML declaration", '\n', `\n${P}`], ["comments and whitespace between prolog tags", "\n\n\n", `\n\n\n${P}`], ])("#given %s #then the probe lands right after the prolog", (_name, html, expected) => { expect(insertAfterProlog(html, P)).toBe(expected) })