// @vitest-environment node import { describe, it, expect } from "vitest"; import { generateCaptionHtml } from "./generator"; import { buildCaptionModel, TranscriptWord } from "./parser"; // --------------------------------------------------------------------------- // Fixtures // --------------------------------------------------------------------------- const SAMPLE_TRANSCRIPT: TranscriptWord[] = [ { text: "We", start: 0.1, end: 0.3 }, { text: "asked", start: 0.4, end: 0.6 }, { text: "what", start: 0.7, end: 0.9 }, { text: "you", start: 1.0, end: 1.2 }, { text: "needed.", start: 1.3, end: 1.8 }, { text: "Forty-seven", start: 1.9, end: 2.3 }, { text: "percent", start: 2.4, end: 2.7 }, ]; function buildTestModel(wordsPerGroup = 5) { return buildCaptionModel(SAMPLE_TRANSCRIPT, { width: 1920, height: 1080, duration: 16, wordsPerGroup, }); } // --------------------------------------------------------------------------- // Tests // --------------------------------------------------------------------------- describe("generateCaptionHtml", () => { describe("HTML structure", () => { it("wraps output in a