// What montage-ops.spec.ts walks (release 35 O1): a two-clip montage seeded // from a phrase, nothing on disk, for the editor stub to fetch // (editor-stub-fetch-windows.mjs): // // s01 opsrumble/vok1 the stub fetches it // s02 opsrumble/vrefuse1 the stub refuses it (the Rumble embed lookup, 403); // its instance's alternate is opsyt/yalt1 at 210 s (YouTube) // // s02 is ruled keep, so the spec sees the ruling move with the stand-in and back. // Its own project and its own channels: the spec writes the manifest, the // rulings and fetch-runs.json, and the stub writes windows under the channels. // Synthetic, like every fixture. import { mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; const write = (dir, name, doc) => { mkdirSync(dir, { recursive: true }); writeFileSync(path.join(dir, name), JSON.stringify(doc, null, 2) + "\n"); }; /** * @param {{ reports: string, channels: string, manifest: Function }} o */ export function makeMontageOpsFixture({ reports, channels, manifest }) { const record = (slug, id, platform, uploadDate, start, text) => write(path.join(channels, slug, "data", id), "transcript.cues.json", { title: `Ops fixture ${id}`, uploadDate, platform, channel: "Ops Fixture", webpageUrl: `https://example.invalid/${id}`, duration: 600, cues: [ { start: start - 3, end: start, text: "and here we go again" }, { start, end: start + 3, text }, { start: start + 3, end: start + 6, text: "moving on" }, ], }); record("opsrumble", "vok1", "rumble", "20230102", 100, "kind of a slow news day today folks"); record("opsrumble", "vrefuse1", "rumble", "20230103", 200, "honestly a slow news day out there people"); record("opsyt", "yalt1", "youtube", "20230103", 210, "honestly a slow news day out there people"); const dir = path.join(reports, "montage-ops-fixture"); const clip = (n, channel, video, at, date) => ({ type: "clip", id: `s0${n}`, channel, video, start: at - 2.5, end: at + 5.5, cutStart: at, cutEnd: at + 3, cite: at, quote: "a slow news day", onscreen: { title: "slow news day", subtitle: date }, montage: { n, of: 2, date: date === "2 Jan 2023" ? "20230102" : "20230103", platform: "rumble", match: "slow news day", speakerCheck: false }, }); const doc = manifest("montage-ops-fixture", "The Montage Ops Fixture", { siteOrigin: "https://archive.example", channelSlug: "opsrumble" }, [ clip(1, "opsrumble", "vok1", 100, "2 Jan 2023"), clip(2, "opsrumble", "vrefuse1", 200, "3 Jan 2023"), ]); doc.render.fetchPad = 0; doc.render.transition = 0; write(dir, "video.manifest.json", doc); const inst = (videoId, start, date, alternates) => ({ slug: "opsrumble", videoId, platform: "rumble", source: "vtt", date, title: `Ops fixture ${videoId}`, duration: 600, start, end: start + 3, cueFirst: 1, cueLast: 1, match: "slow news day", context: "a slow news day", speakerCheck: false, availability: null, alternates, }); write(dir, "phrase-scan.json", { phrase: String.raw`slow[\s,]+news`, channels: ["opsyt"], prefer: "opsrumble", exclude: null, scanned: 3, hits: 3, instances: [ inst("vok1", 100, "20230102", []), inst("vrefuse1", 200, "20230103", [{ slug: "opsyt", videoId: "yalt1", start: 210, end: 213, platform: "youtube", availability: null }]), ], dropped: [], }); write(dir, "montage-rulings.json", { version: 1, rulings: { "opsrumble/vrefuse1@200.00": { verdict: "keep", reason: "", at: "2026-10-18T21:00:00.000Z" } } }); return { dir }; }