import { describe, it, expect } from "vitest"; import { Tokenizer } from "./index.js"; import type { Callbacks } from "./Tokenizer.js"; function tokenize(data: string, options = {}) { const log: unknown[][] = []; const tokenizer = new Tokenizer( options, new Proxy( {}, { get(_, property) { return (...values: unknown[]) => log.push([property, ...values]); }, }, ) as Callbacks, ); tokenizer.write(data); tokenizer.end(); return log; } describe("Tokenizer", () => { describe("should support self-closing special tags", () => { it("for self-closing script tag", () => { expect(tokenize("
")).toMatchSnapshot(); }); it("for self-closing style tag", () => { expect(tokenize("")).toMatchSnapshot(); }); it("for self-closing title tag", () => { expect(tokenize("