// A post's SCREENS, round 2 (lane/screens-2): a screen made from a picture-only post's READ (`posts screen … add // --from-read`, post-screens.mjs linesOfRead / screenFromRead) and a LINE RECORDED by the operator (`posts screen … // record`, the bench's per-line Record): kept as new takes of the item that are never its read, converted only to the // speaker's character's stock voice, chosen for a line by hand (`--line-take`, the screen's `lineTakes`), refused when // they are another line's or the line changed. No editor (stub ops), no real audio (synthetic tones), temp dirs. import assert from "node:assert/strict"; import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; import { after, test } from "node:test"; import { encodeWav16 } from "yt-dlp-transcript-common/lib/montage/voiceMatch.mjs"; import { VOICE_A, VOICE_B, syntheticVoice, withSilence } from "yt-dlp-transcript-common/testing/audio/syntheticVoice.mjs"; import { postsCommand } from "./postsCli.mjs"; import { linesOfRead, maskShapes, screenFromRead } from "umtool-report-to-video/post-screens"; import { ownPictureOnly, validatePostItem } from "umtool-report-to-video/post-item"; const ROOT = await mkdtemp(path.join(tmpdir(), "umtool-screens2-")); after(() => rm(ROOT, { recursive: true, force: true })); const wavOf = async (file, voice, seconds = 1.2) => { await mkdir(path.dirname(file), { recursive: true }); await writeFile(file, encodeWav16(withSilence(syntheticVoice({ ...voice, seconds }), { before: 0.1, after: 0.1 }))); }; const IMG = { src: "posts-media/kir-x/7/7_1.jpg", kind: "image", width: 900, height: 1400 }; const GIF = { src: "posts-media/kir-x/7/7_2.mp4", kind: "gif", width: 480, height: 270, seconds: 2.53 }; const PIC = { type: "post", id: "p-7", post: "kir-x/7", platform: "x", author: "Kirsche", handle: "kirsche", date: "2026-11-02T01:40:36.000Z", text: "@thequartering", media: [IMG], narration: { script: "I never said that.\n\nOrder number: 4419283 was refunded on 11/02/2026.\n", takes: [{ file: "narration/posts/7/take-1.kokoro-af_heart.wav", engine: "kokoro", voice: "af_heart", seconds: 3, script: "I never said that." }], pick: 0 }, }; async function project(name, item) { const dir = path.join(ROOT, name); await mkdir(dir, { recursive: true }); for (const t of item.narration?.takes ?? []) await wavOf(path.join(dir, t.file), VOICE_A, 1); await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify({ schemaVersion: 1, slug: name, title: name, provenance: { channelsDir: "../channels", channelSlug: "chan" }, render: { width: 1920, height: 1080, fps: 30, postNarration: { engine: "kokoro", voice: "af_heart" } }, timeline: [item], }, null, 2)); return { id: name, dir }; } const read = async (p) => JSON.parse(await readFile(path.join(p.dir, "video.manifest.json"), "utf8")); const posts = async (args) => { const lines = []; const code = await postsCommand(args, { root: ROOT, out: (s) => lines.push(s), err: (s) => lines.push(s) }); return { code, text: lines.join("\n"), json: () => JSON.parse(lines.join("\n")) }; }; // --------------------------------------------------------------------------- // ITEM 3: --from-read // --------------------------------------------------------------------------- test("linesOfRead: a line per line of the script, blank lines and emotion tags dropped, a long line split at its sentences -- never a speaker parsed out", () => { assert.deepEqual(linesOfRead("I never said that.\n\n \nOrder number: 4419283 was refunded today."), [{ text: "I never said that." }, { text: "Order number: 4419283 was refunded today." }]); // A "who: words" is words: a shape or a heading is never a speaker (round 1's p7). for (const raw of ["Order number: 4419", "Ref: AB-1234", "savvy@gmail.com: hi there", "Phone: 555 201 4477", "TheQuartering: hi"]) assert.deepEqual(linesOfRead(raw), [{ text: raw }], raw); const long = Array.from({ length: 30 }, (_, i) => `Sentence number ${i} goes on for a little while.`).join(" "); const out = linesOfRead(long); assert.ok(out.length > 1 && out.every((l) => l.text.length <= 600 && /\.$/.test(l.text)), "split at sentence ends"); assert.equal(out.map((l) => l.text).join(" "), long); const noStop = "word ".repeat(200).trim(); assert.ok(linesOfRead(noStop).every((l) => l.text.length <= 600 && !/^ | $/.test(l.text))); assert.throws(() => linesOfRead(" \n \n"), /no words/); assert.throws(() => linesOfRead(Array.from({ length: 61 }, (_, i) => `line ${i}`).join("\n")), /at most 60/); }); test("screenFromRead: a picture-only post's script made a screen on its picture, read whole, NOT checked; refused for any other post", () => { const made = screenFromRead(PIC, { pictureOnly: ownPictureOnly(PIC), id: "s1" }); assert.deepEqual(made.screen, { id: "s1", media: 0, kind: "text", source: "read", lines: [{ text: "I never said that." }, { text: "Order number: 4419283 was refunded on 11/02/2026." }], read: "all" }); assert.deepEqual(validatePostItem({ ...PIC, screens: [made.screen] }), []); // Its shapes are masked like any line's (the order number drawn as a bar, never said); its date stays. assert.ok(!maskShapes(made.screen.lines[1].text).text.includes("4419283")); assert.ok(maskShapes(made.screen.lines[1].text).text.includes("11/02/2026")); // A GIF: visible its whole length. const gif = screenFromRead({ ...PIC, media: [GIF] }, { pictureOnly: true, id: "s1", kind: "dm" }); assert.deepEqual([gif.screen.at, gif.screen.kind], [[0, 2.53], "dm"]); assert.match(screenFromRead({ ...PIC, media: [{ ...GIF, seconds: undefined }] }, { pictureOnly: true, id: "s1" }).error, /--at/); assert.match(screenFromRead({ ...PIC, text: "a whole sentence of words" }, { pictureOnly: false, id: "s1" }).error, /not a picture-only post/); assert.match(screenFromRead({ ...PIC, narration: { ...PIC.narration, script: "" } }, { pictureOnly: true, id: "s1" }).error, /no words/); assert.match(screenFromRead(PIC, { pictureOnly: true, id: "s1", kind: "chat" }).error, /--kind takes/); assert.match(screenFromRead(PIC, { pictureOnly: true, id: "s1", media: 4 }).error, /--media 4/); }); test("the CLI: posts screen … add --from-read writes one screen from narration.script (not checked; the lint says so); refused off a picture-only post", async () => { const p = await project("fromread", PIC); let r = await posts(["screen", "fromread", "p-7", "add", "--from-read", "--dry-run"]); assert.equal(r.code, 0, r.text); assert.equal((await read(p)).timeline[0].screens, undefined, "a dry run writes nothing"); r = await posts(["screen", "fromread", "p-7", "add", "--from-read", "--title", "A statement", "--json"]); assert.equal(r.code, 0, r.text); const j = r.json(); assert.deepEqual(j.screens[0].lines.map((l) => l.text), ["I never said that.", "Order number: 4419283 was refunded on 11/02/2026."]); assert.equal(j.screens[0].title, "A statement"); assert.equal(j.screens[0].checked, undefined); assert.ok(j.warnings.some((w) => /screen s1's transcription not checked/.test(w))); assert.ok(j.warnings.some((w) => /does not read screen s1/.test(w)), "nothing drawn until the read reads it"); r = await posts(["screen", "fromread", "p-7", "add", "--from-read", "--line", "a: b"]); assert.equal(r.code, 2); await project("fromread2", { ...PIC, text: "A post with words of its own." }); r = await posts(["screen", "fromread2", "p-7", "add", "--from-read"]); assert.equal(r.code, 2); assert.match(r.text, /not a picture-only post/); }); // --------------------------------------------------------------------------- // ITEM 1: a screen line recorded by the operator // --------------------------------------------------------------------------- const DM = { id: "s1", media: 0, kind: "dm", read: "all", lines: [ { who: "TheQuartering", text: "what's your email so I can refund your order" }, { who: "MadamSavvy", text: "call me at 555 201 4477 tonight" }, { who: "TheQuartering", text: "You can't be this dumb" }, { who: "Stranger", text: "who is this" }, { who: "TheQuartering", text: "ask @secretkid about it" }, ] }; const OWN = { file: "narration/posts/2117/take-1.recorded-operator.wav", engine: "recorded", voice: "operator", label: "operator", seconds: 1.4, script: "Hey, you told me. Your turn.", source: { kind: "recorded", voice: "operator" } }; const SAVVY = { type: "post", id: "p-2117", post: "savvy-x/2117", platform: "x", author: "Savvy", handle: "MadamSavvy", date: "2026-11-02T01:40:36.000Z", text: "Hey, you told me. Your turn.", subjects: ["MadamSavvy"], media: [IMG], screens: [DM], narration: { script: "Hey, you told me. Your turn.", takes: [OWN], pick: 0 }, }; // This video's characters: TheQuartering converts to a stock voice; Savvy (the author) to hers; the narrator is never a line's. const CHARS = { format: "umtool-project-characters", version: 1, characters: [ { id: "tq", name: "Jeremy", handles: ["thequartering"], synthetic: { voice: "kokoro:am_michael" }, recorded: { convert: { engine: "openvoice", voice: "kokoro:am_michael" } } }, { id: "savvy", name: "Savvy", handles: ["madamsavvy"], synthetic: { voice: "kokoro:af_bella" }, recorded: { convert: { engine: "openvoice", voice: "kokoro:af_bella" } } }, { id: "kid", name: "Secret Kid", handles: ["secretkid"], anonymous: true, shown: "Kid A" }, ] }; async function savvy(name, item = SAVVY, chars = CHARS) { const p = await project(name, item); await mkdir(path.join(p.dir, "narration"), { recursive: true }); if (chars) await writeFile(path.join(p.dir, "narration", "characters.json"), JSON.stringify(chars)); return p; } /** The editor's ops, stubbed: each writes its out file as a tone and answers as the editor does. */ const stubOps = (asked, heard = null) => async (route, body) => { asked.push({ route, body }); if (route === "/api/ops/transcribe") { await writeFile(body.out, JSON.stringify({ words: String(heard ?? "").split(/\s+/).filter(Boolean).map((w, i) => ({ w, start: i * 0.3, end: i * 0.3 + 0.25 })) })); return { jobId: `job-t${asked.length}`, result: {} }; } await wavOf(body.out, VOICE_B, 1); return { jobId: `job-${asked.length}`, result: route.endsWith("voice-convert") ? { op: "convert", engine: body.engine ?? "openvoice", voice: String(body.voice ?? "").split(":").pop() } : { op: "enhance", engine: "deepfilternet" } }; }; const stubTts = (asked) => async (body) => { asked.push(body); await wavOf(body.out, VOICE_B, 0.6); return { jobId: `tts-${asked.length}`, result: { wav: body.out } }; }; const recording = async (p, name = "rec.wav") => { const f = path.join(ROOT, `${p.id}-${name}`); await wavOf(f, VOICE_A, 1.2); return f; }; const NO_RED = { terms: [], markup: {}, slurs: null }; test("lineToRecord: the line as the read says it -- its shapes left out, an anonymous handle as its shown name, the lexicon only in the script; a line not read or redacted refused", async () => { const { lineToRecord } = await import("./screenLineRecord.mjs"); const red = { terms: [], markup: {}, slurs: null, say: [{ word: "dumb", say: "dumm" }], anon: new Map([["secretkid", "Kid A"]]) }; const a = lineToRecord(SAVVY, "screen:s1:2", { red }); assert.equal(a.prompt, "You can't be this dumb"); assert.equal(a.script, "You can't be this dumm", "the script says it the lexicon's way: what the read holds the take to"); assert.equal(a.written, "You can't be this dumb"); assert.deepEqual([a.speaker, a.handle, a.self], ["TheQuartering", "TheQuartering", false]); const b = lineToRecord(SAVVY, "screen:s1:1", { red }); assert.ok(!/555|4477/.test(b.prompt + b.script + b.written), "a masked number is never in the prompt nor the script (R2 #2)"); assert.equal(b.self, true); const c = lineToRecord(SAVVY, "screen:s1:4", { red }); assert.ok(!/secretkid/i.test(c.prompt + c.script) && /Kid A/.test(c.script), "an anonymous handle said as its shown name"); const unread = { ...SAVVY, screens: [{ ...DM, read: [{ line: 0 }] }] }; assert.throws(() => lineToRecord(unread, "screen:s1:2", { red }), /not read by the screen/); const redacted = { ...SAVVY, screens: [{ ...DM, lines: DM.lines.map((l, n) => (n === 2 ? { ...l, redact: true } : l)) }] }; assert.throws(() => lineToRecord(redacted, "screen:s1:2", { red }), /redacted/); assert.throws(() => lineToRecord(SAVVY, "screen:s9:0", { red }), /no screen s9/); assert.throws(() => lineToRecord(SAVVY, "screen:s1:9", { red }), /no line 9/); }); test("record: recorded, cleaned, converted to the SPEAKER's character's stock voice -- each a new take, none picked, the item's script untouched; a line take, never the item's read", async () => { const { recordScreenLine } = await import("./screenLineRecord.mjs"); const p = await savvy("rec"); const asked = []; const r = await recordScreenLine(p, "p-2117", "screen:s1:2", await recording(p), { ask: stubOps(asked) }); assert.deepEqual(asked.map((x) => x.route), ["/api/ops/voice-enhance", "/api/ops/voice-convert"]); assert.equal(asked[1].body.voice, "kokoro:am_michael", "TheQuartering's character's stock voice"); assert.equal(r.picked, null); assert.equal(r.disclosure, "a recorded reading converted to a stock voice (openvoice · kokoro:am_michael)"); assert.equal(r.line.prompt, "You can't be this dumb"); const n = (await read(p)).timeline[0].narration; assert.equal(n.pick, 0, "his own read still plays"); assert.equal(n.script, SAVVY.narration.script, "the item's script untouched"); assert.equal(n.takes.length, 4); for (const t of n.takes.slice(1)) { assert.deepEqual(t.screenLine, { screen: "s1", n: 2, said: "You can't be this dumb", speaker: "TheQuartering" }); assert.equal(t.script, "You can't be this dumb"); } assert.match(n.takes[1].file, /take-2\.recorded-operator\.wav$/, "a NEW recorded file"); assert.equal(n.takes[3].steps[0].op, "convert"); // The original recording of his words is untouched (never rewritten). assert.equal(n.takes[0].file, OWN.file); // Picking a line take is refused in the build's words. const { updatePostNarration } = await import("./manifest.mjs"); await assert.rejects(() => updatePostNarration(p.dir, "p-2117", { pick: 3 }), /take 4 is a recording of line 2 of screen s1/); }); test("record: a speaker with no character is kept as recorded (a note); the author's own line converts to HER character, never the narrator", async () => { const { recordScreenLine } = await import("./screenLineRecord.mjs"); const p = await savvy("rec-who"); const asked = []; const a = await recordScreenLine(p, "p-2117", "screen:s1:3", await recording(p, "a.wav"), { ask: stubOps(asked) }); assert.ok(a.notes.some((x) => /line 3's speaker has no character to convert to -- kept as recorded/.test(x))); assert.ok(!asked.some((x) => x.route.endsWith("voice-convert"))); assert.equal(a.disclosure, "a recorded reading"); const b = await recordScreenLine(p, "p-2117", "screen:s1:1", await recording(p, "b.wav"), { ask: stubOps(asked) }); assert.equal(asked.at(-1).body.voice, "kokoro:af_bella"); assert.match(b.disclosure, /af_bella/); // A cast narrator is never a line's character. const p2 = await savvy("rec-narr", SAVVY, null); await mkdir(path.join(p2.dir, ".umtool"), { recursive: true }); await writeFile(path.join(p2.dir, ".umtool", "cast.json"), JSON.stringify({ format: "umtool-cast", version: 1, characters: [{ id: "me", name: "Me", handles: ["operator"], voice: "kokoro:bm_george", convert: { engine: "openvoice" }, narrator: true }] })); const asked2 = []; const c = await recordScreenLine(p2, "p-2117", "screen:s1:0", await recording(p2), { ask: stubOps(asked2) }); assert.ok(!asked2.some((x) => x.route.endsWith("voice-convert")), "no convert to the narrator"); assert.ok(c.notes.some((x) => /no character/.test(x))); }); test("record is refused on an item with no read of its own; --check-words refuses a recording heard saying a number or a handle (nothing kept) and warns on other words", async () => { const { recordScreenLine } = await import("./screenLineRecord.mjs"); const bare = await savvy("rec-bare", { ...SAVVY, narration: undefined }); await assert.rejects(() => recordScreenLine(bare, "p-2117", "screen:s1:2", path.join(ROOT, "nope.wav"), { ask: stubOps([]) }), /no read of its own yet/); const p = await savvy("rec-check"); const file = await recording(p); for (const heard of ["call me at 555 201 4477 tonight", "you can't be this dumb @secretkid", "you can't be secretkid this dumb"]) { await assert.rejects(() => recordScreenLine(p, "p-2117", "screen:s1:2", file, { ask: stubOps([], heard), checkWords: true }), /--check-words: .* refused -- it is heard saying/, heard); } assert.equal((await read(p)).timeline[0].narration.takes.length, 1, "a refusal keeps nothing"); assert.equal((await readdir(path.join(p.dir, "narration/posts/2117"))).filter((f) => f.startsWith(".line-check")).length, 0, "its scratch is gone"); const w = await recordScreenLine(p, "p-2117", "screen:s1:2", file, { ask: stubOps([], "you can this be dumb"), checkWords: true, convert: false, clean: false }); assert.ok(w.notes.some((x) => /not the line's in order/.test(x))); const ok = await recordScreenLine(p, "p-2117", "screen:s1:2", file, { ask: stubOps([], "You can't be this dumb"), checkWords: true, convert: false, clean: false }); assert.ok(ok.notes.some((x) => /heard saying the line/.test(x))); }); test("a line take is read ONLY when chosen: the screen's lineTakes (set take.=) or --line-take; another line's or a stale one refused; the disclosure says what it is", async () => { const { recordScreenLine } = await import("./screenLineRecord.mjs"); const { threadTake, postTakeOf } = await import("./postThreadRead.mjs"); const { postNarrationDisclosure } = await import("umtool-report-to-video/post-narration"); const { lineTakeWarnings, threadReadErrors } = await import("umtool-report-to-video/post-thread"); const p = await savvy("choose"); await recordScreenLine(p, "p-2117", "screen:s1:2", await recording(p), { ask: stubOps([]) }); let e = (await read(p)).timeline[0]; // Not chosen: synthesized, and said so. const tts = []; let r = await posts(["screen", "choose", "p-2117", "read", "--dry-run"]); assert.equal(r.code, 0, r.text); assert.match(r.text, /screen:s1:2 is synthesized: its recordings take 2, take 3, take 4 not chosen -- --line-take screen:s1:2=4/); assert.ok(lineTakeWarnings(e).some((x) => /line 2 of screen s1 has a recording no read uses/.test(x))); // Chosen by number; another line's take refused; off unchooses. r = await posts(["screen", "choose", "p-2117", "set", "s1", "take.0=4"]); assert.equal(r.code, 2); assert.match(r.text, /take 4 does not say line 0 of screen s1 as it is now \(it was recorded for line 2/); r = await posts(["screen", "choose", "p-2117", "set", "s1", "take.2=4"]); assert.equal(r.code, 0, r.text); e = (await read(p)).timeline[0]; assert.deepEqual(e.screens[0].lineTakes, { 2: "take-4.convert-openvoice" }); r = await posts(["screen", "choose", "p-2117", "list"]); assert.match(r.text, /2 TheQuartering: You can't be this dumb {3}\[recorded: take 2, take 3, take 4 \(chosen\)\]/); const made = await threadTake(p, e, { red: NO_RED, ask: stubTts(tts), lanes: null, postTake: 1 }); const parts = made.take.parts; assert.equal(parts.find((x) => x.role === "screen:s1:2").take, "take-4.convert-openvoice"); assert.ok(!tts.some((b) => /dumb/.test(b.text)), "the chosen line is not synthesized"); const after1 = (await read(p)).timeline[0]; assert.deepEqual(threadReadErrors(after1, {}), []); assert.deepEqual(lineTakeWarnings(after1).filter((x) => !/was not heard/.test(x)), [], "only that nothing heard it"); // The disclosure names the converted recording (and the synthetic voices of the rest). assert.match(postNarrationDisclosure(after1), /a recorded reading converted to a stock voice \(openvoice · kokoro:am_michael\)/); // A line take is never his words, and never another line's. assert.throws(() => postTakeOf(after1, 4), /a recording of line 2 of screen s1: it is read in that line's place/); assert.throws(() => postTakeOf(after1, 4, { line: "screen:s9:0" }), /a recording of a line of screen s1, not of screen:s9:0/); // Another line's words: refused by its content (owned by what it says, not by its index). await assert.rejects(() => threadTake(p, after1, { red: NO_RED, ask: stubTts([]), lanes: null, postTake: 1, lineTakes: { "screen:s1:0": 4 }, force: true }), /does not say line 0 of screen s1 as it is now/); // The line edited since it was recorded: the chosen take is refused, never played under new words (R1 #1). r = await posts(["screen", "choose", "p-2117", "set", "s1", "line.2.text=You cannot be this dumb"]); assert.equal(r.code, 0, r.text); const edited = (await read(p)).timeline[0]; assert.ok(lineTakeWarnings(edited).some((x) => /its chosen take \(take 4\) was recorded for the line as it was/.test(x))); await assert.rejects(() => threadTake(p, edited, { red: NO_RED, ask: stubTts([]), lanes: null, postTake: 1, force: true }), /does not say line 2 of screen s1 as it is now/); // Given to another speaker since: the same. r = await posts(["screen", "choose", "p-2117", "set", "s1", "line.2.text=You can't be this dumb", "line.2.who=Stranger"]); assert.equal(r.code, 0, r.text); const given = (await read(p)).timeline[0]; await assert.rejects(() => threadTake(p, given, { red: NO_RED, ask: stubTts([]), lanes: null, postTake: 1, force: true }), /does not say line 2 of screen s1 as it is now/); r = await posts(["screen", "choose", "p-2117", "set", "s1", "take.2=off"]); assert.equal(r.code, 0, r.text); assert.equal((await read(p)).timeline[0].screens[0].lineTakes, undefined); // A chosen take cannot be deleted until it is unchosen. const q = await savvy("choose-del"); await recordScreenLine(q, "p-2117", "screen:s1:0", await recording(q), { ask: stubOps([]), clean: false, convert: false }); assert.equal((await posts(["screen", "choose-del", "p-2117", "set", "s1", "take.0=2"])).code, 0); r = await posts(["narrate", "choose-del", "p-2117", "--delete", "2"]); assert.notEqual(r.code, 0); assert.match(r.text, /chosen for line 0 of screen s1: unchoose it first/); assert.equal((await read(q)).timeline[0].narration.takes.length, 2, "nothing moved"); }); test("the data: lineTakes names a recording of a line of that screen; a line removed takes its choice with it, the later ones' keys move down -- and the choice still plays (owned by content, l1 #1b)", async () => { const { withoutLines, validateScreens } = await import("umtool-report-to-video/post-screens"); const { lineTakesOf } = await import("umtool-report-to-video/post-thread"); const rec = (n, file, screen = "s1") => ({ file, engine: "recorded", voice: "operator", seconds: 1, script: "x", screenLine: { screen, n, said: n === 2 ? "You can't be this dumb" : "ask Kid A about it", speaker: "TheQuartering" } }); const e = { ...SAVVY, narration: { ...SAVVY.narration, takes: [OWN, rec(2, "narration/posts/2117/take-2.recorded-operator.wav"), rec(4, "narration/posts/2117/take-3.recorded-operator.wav"), rec(0, "narration/posts/2117/take-4.recorded-operator.wav", "s9")] } }; const sc = { ...DM, lineTakes: { 2: "take-2.recorded-operator", 4: "take-3.recorded-operator" } }; assert.deepEqual(validateScreens({ ...e, screens: [sc] }), []); assert.ok(validateScreens({ ...e, screens: [{ ...DM, lineTakes: { 0: "take-4.recorded-operator" } }] }).some((x) => /take 4 is not a recording of a line of screen s1 \(it is of screen s9\)/.test(x))); // Line 0 removed above line 2's chosen take: the choice moves to key 1 and the take still says that line (current). const moved = { ...e, screens: [withoutLines(sc, [0])] }; assert.deepEqual(validateScreens(moved), []); const L = lineTakesOf(moved).find((x) => x.role === "screen:s1:1"); assert.deepEqual(L.takes.map((t) => [t.n, t.current, t.chosen]), [[2, true, true]]); assert.ok(validateScreens({ ...e, screens: [{ ...DM, lineTakes: { 2: "take-9.nope" } }] }).some((x) => /must be the id of one of the item's takes/.test(x))); assert.ok(validateScreens({ ...e, screens: [{ ...DM, lineTakes: { 7: "take-2.recorded-operator" } }] }).some((x) => /has no line 7/.test(x))); assert.deepEqual(withoutLines(sc, [2]).lineTakes, { 3: "take-3.recorded-operator" }); assert.deepEqual(withoutLines(sc, [0]).lineTakes, { 1: "take-2.recorded-operator", 3: "take-3.recorded-operator" }); assert.equal("lineTakes" in withoutLines({ ...DM, lineTakes: { 2: "x" } }, [2]), false); });