// The posting exports of a NARRATED cut carry the disclosure line (release 25, // T2): the description and the chapters list say "Narration: synthetic voice // ( · )"; a cut without narration exports exactly as it did. // // Run with: pnpm test:scripts import assert from "node:assert/strict"; import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import path from "node:path"; import test from "node:test"; import { exportProject } from "./export.mjs"; const FFMETA = (n) => [";FFMETADATA1", "", ...Array.from({ length: n }, (_, i) => ["[CHAPTER]", "TIMEBASE=1/1000", `START=${i * 5000}`, `END=${(i + 1) * 5000}`, `title=Entry ${i + 1}`, ""]).flat()].join("\n"); function project(root, timeline) { const dir = path.join(root, `p-${Math.random().toString(36).slice(2)}`); mkdirSync(path.join(dir, "out", "sourced"), { recursive: true }); writeFileSync(path.join(dir, "video.manifest.json"), JSON.stringify({ slug: "s", title: "A cut", provenance: { siteOrigin: "https://example.test", channelSlug: "chan" }, render: { fps: 30 }, timeline, })); writeFileSync(path.join(dir, "out", "sourced", "chapters.ffmeta"), FFMETA(timeline.length)); return dir; } test("description and chapters disclose a narrated cut's synthetic voice; a plain cut's are unchanged", async (t) => { const root = mkdtempSync(path.join(tmpdir(), "umtool-export-narration-")); t.after(() => rmSync(root, { recursive: true, force: true })); const clip = { id: "c1", type: "clip", video: "v1", start: 1, end: 4 }; const narrated = project(root, [ { id: "k1", type: "card", heading: "Then", seconds: "auto", narration: { text: "Then it happened." } }, clip, ]); const plain = project(root, [{ id: "k1", type: "card", heading: "Then", seconds: 4 }, clip]); const line = "Narration: synthetic voice (Kokoro-82M · af_heart)"; const desc = (await exportProject(narrated, "description")).text; assert.ok(desc.trimEnd().endsWith(line), desc); const chapters = (await exportProject(narrated, "chapters")).text; assert.equal(chapters, `00:00 Then\n00:05 2. v1\n\n${line}\n`); assert.ok(!(await exportProject(plain, "description")).text.includes("Narration")); assert.equal((await exportProject(plain, "chapters")).text, "00:00 Then\n00:05 2. v1\n"); });