// Quick clip (lane output-modes): `umtool clip /@-` -- a // basic-mode project, its window asked of the editor, the edges snapped to the // words heard, rendered as a take, the output and its share line. The editor // and the render are the flow's dependencies, stubbed here; e2e // (basic-mode.spec.ts) runs it whole against the stub editor. Synthetic. // // Run with: pnpm test:scripts import assert from "node:assert/strict"; import { spawnSync } from "node:child_process"; import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs"; import { mkdir, readFile, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; import test from "node:test"; const ROOT = mkdtempSync(path.join(tmpdir(), "umtool-quick-")); const CORPUS = path.join(ROOT, "channels"); const SITES = path.join(ROOT, "sites"); const REPORTS = path.join(ROOT, "reports"); process.env.CHANNELS_DIR = CORPUS; process.env.SITES_DIR = SITES; process.env.CHANNELS_FALLBACK = "0"; const { quickClip, quickClipCommand, quickClipSlug, quickClipSpec, siteOriginFor, snapToWords } = await import("./quickClip.mjs"); const { shareCommand } = await import("./shareLineCli.mjs"); test.after(() => rm(ROOT, { recursive: true, force: true })); const have = spawnSync("ffmpeg", ["-version"]).status === 0; const json = (file, doc) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, JSON.stringify(doc)); }; json(path.join(CORPUS, "yt", "config.json"), { platform: "youtube", url: "https://www.youtube.com/@yt" }); json(path.join(CORPUS, "yt", "data", "vid1", "transcript.cues.json"), { webpageUrl: "https://www.youtube.com/watch?v=vid1", cues: [{ start: 40, end: 60, text: "words" }] }); json(path.join(SITES, "a-site", "site.json"), { siteUrl: "https://a-site.example/", channels: [{ slug: "yt" }] }); json(path.join(SITES, "private", "site.json"), { channels: [{ slug: "yt" }] }); test("quickClipSlug: the title's words, else -