// Gaps inside a clip (gaps.mjs): the rule a clip's `gaps` keep, the two clocks // (source ↔ the gapped segment), the pieces that play, the frame grid, the // edits the CLI and the bench ask for, and the filtergraph that takes them out // -- the strings, and a real ffmpeg run on a synthetic clip: the picture and // the sound come out the kept seconds long, the gap's black and silence gone. // // Run with: pnpm test:scripts import assert from "node:assert/strict"; import { spawnSync } from "node:child_process"; import { mkdtempSync, rmSync } from "node:fs"; import os from "node:os"; import path from "node:path"; import test from "node:test"; import { GAP_FADE, GAP_LIMITS, editGaps, mergedOwnKeys, gapFilterParts, gapWalls, gapSeconds, gappedLength, gapsOf, gapsOnSegment, gapsText, gapsWithin, inGap, keptSpans, normalizeGaps, offsetIn, parseGapSpec, recordGaps, renderGaps, sourceAtOffset, validateGapEntries, validateGaps, } from "./gaps.mjs"; const CLIP = { type: "clip", id: "c1", video: "v", start: 100, end: 120, cutStart: 102, cutEnd: 118 }; const G = [{ from: 105, to: 107 }, { from: 110, to: 110.5 }]; // ---- validation ------------------------------------------------------------- test("validateGaps: absent, null or [] is none; a list inside the cut, apart and long enough is fine", () => { assert.deepEqual(validateGaps(CLIP), []); assert.deepEqual(validateGaps({ ...CLIP, gaps: null }), []); assert.deepEqual(validateGaps({ ...CLIP, gaps: [] }), []); assert.deepEqual(validateGaps({ ...CLIP, gaps: G }), []); // No cut: the extent is the span. const { cutStart: _a, cutEnd: _b, ...noCut } = CLIP; assert.deepEqual(validateGaps({ ...noCut, gaps: [{ from: 100.5, to: 101 }] }), []); assert.match(validateGaps({ ...CLIP, gaps: [{ from: 100.5, to: 101 }] })[0], /outside the clip's cut 102–118/); }); test("validateGaps: each refusal names what is wrong", () => { const one = (gaps, extra = {}) => validateGaps({ ...CLIP, ...extra, gaps }); assert.match(one({ from: 105, to: 106 })[0], /must be a list/); assert.match(one([{ from: 105 }])[0], /gaps\[0\] must be \{ from, to \}/); assert.match(one([{ from: 105, to: 105.1 }])[0], /under 0.2 s/); assert.match(one([{ from: 110, to: 111 }, { from: 105, to: 106 }])[0], /in order/); assert.match(one([{ from: 105, to: 107 }, { from: 106.5, to: 108 }])[0], /overlaps gaps\[0\]/); assert.match(one([{ from: 105, to: 107 }, { from: 107.2, to: 108 }])[0], /leaves 0.20 s after gaps\[0\]; keep at least 0.5 s/); assert.match(one([{ from: 102.3, to: 103 }])[0], /after the cut's start/); assert.match(one([{ from: 117, to: 117.8 }])[0], /before the cut's end/); assert.match(one([{ from: 117, to: 119 }])[0], /outside the clip's cut/); // At most 40 (a long clip cut down to its sentences); 40 is fine, 41 is not. const many = (n) => Array.from({ length: n }, (_, k) => ({ from: 100 + k * 1.5, to: 100.3 + k * 1.5 })); assert.deepEqual(validateGaps({ ...CLIP, start: 0, end: 200, cutStart: 99, cutEnd: 170, gaps: many(40) }), []); assert.match(validateGaps({ ...CLIP, start: 0, end: 200, cutStart: 99, cutEnd: 170, gaps: many(41) })[0], /at most 40 gaps/); assert.match(validateGaps({ type: "card", id: "k", gaps: G })[0], /only a clip/); }); test("validateGaps: a mute mark or a claim mark strictly inside a gap is refused; on its edge it is fine", () => { assert.match(validateGaps({ ...CLIP, gaps: G, muteFrom: 106 })[0], /muteFrom 106 lies inside the gap 105–107/); assert.deepEqual(validateGaps({ ...CLIP, gaps: G, muteFrom: 107 }), [], "at the gap's end: the join"); assert.deepEqual(validateGaps({ ...CLIP, gaps: G, muteFrom: 105 }), [], "at its start"); assert.match(validateGaps({ ...CLIP, gaps: G, claim: { id: "k1", verdict: "FALSE", at: 110.2 } })[0], /the mark k1's second \(at 110.2\) lies inside the gap 110–110.5/); assert.match(validateGaps({ ...CLIP, gaps: G, claims: [{ id: "a", verdict: "FALSE", at: 103 }, { id: "b", verdict: "FALSE", at: 106 }] })[0], /mark b's/); assert.deepEqual(validateGaps({ ...CLIP, gaps: G, claim: { id: "k1", verdict: "FALSE", at: 108 } }), []); }); test("validateGapEntries: every clip of the timeline, named by index", () => { const errs = validateGapEntries({ timeline: [CLIP, { ...CLIP, id: "c2", gaps: [{ from: 1, to: 2 }] }] }); assert.equal(errs.length, 1); assert.match(errs[0], /^timeline\[1\] \(c2\)\.gaps\[0\]/); }); // ---- the clocks --------------------------------------------------------------- test("offsetIn / sourceAtOffset: the seconds that play; without gaps the subtraction it always was", () => { // Byte for byte: no gaps is `src - from`, and its inverse `from + off`. for (const [src, from] of [[105.37, 101.6], [0.1 + 0.2, 0.1], [32989.123, 32986.1]]) { assert.equal(offsetIn(src, from, []), src - from); assert.equal(offsetIn(src, from, null), src - from); assert.equal(sourceAtOffset(src - from, from, undefined), from + (src - from)); } const from = 101.6; assert.equal(offsetIn(104, from, G), 104 - from); assert.ok(Math.abs(offsetIn(108, from, G) - (108 - from - 2)) < 1e-9, "after the first gap: 2 s earlier"); assert.ok(Math.abs(offsetIn(106, from, G) - (105 - from)) < 1e-9, "inside a gap: at its join"); assert.ok(Math.abs(offsetIn(112, from, G) - (112 - from - 2.5)) < 1e-9, "after both"); // The inverse lands after each gap, and round-trips every second that plays. assert.ok(Math.abs(sourceAtOffset(105 - from, from, G) - 107) < 1e-9, "the join shows the material after the gap"); for (const src of [101.6, 103, 104.99, 107, 109.3, 110.5, 115]) { assert.ok(Math.abs(sourceAtOffset(offsetIn(src, from, G), from, G) - src) < 1e-9, `round trip ${src}`); } }); test("keptSpans, gappedLength, gapSeconds, gapsWithin", () => { assert.deepEqual(keptSpans(102, 118, []), [{ from: 102, to: 118 }]); assert.deepEqual(keptSpans(102, 118, G), [{ from: 102, to: 105 }, { from: 107, to: 110 }, { from: 110.5, to: 118 }]); assert.equal(gappedLength(102, 118, []), 16); assert.equal(gappedLength(102, 118, G), 13.5); assert.equal(gapSeconds(G), 2.5); assert.equal(gapSeconds(G, 106, 120), 1.5); // A snapped edge that moved into a gap clips it; one past it drops it. assert.deepEqual(gapsWithin(G, 106, 110.2), [{ from: 106, to: 107 }, { from: 110, to: 110.2 }]); assert.deepEqual(gapsWithin(G, 108, 118), [{ from: 110, to: 110.5 }]); assert.equal(inGap(106, G), G[0]); assert.equal(inGap(105, G), null); }); test("gapsOf / renderGaps / recordGaps: the well-formed ones, sorted; none in a montage", () => { assert.deepEqual(gapsOf({ ...CLIP, gaps: [G[1], G[0], { from: 1 }] }), G); assert.deepEqual(gapsOf(CLIP), []); assert.deepEqual(renderGaps({ ...CLIP, gaps: G }, {}), G); assert.deepEqual(renderGaps({ ...CLIP, gaps: G }, { montage: { style: "wall" } }), []); assert.deepEqual(recordGaps({ start: 1, end: 2 }), []); assert.deepEqual(recordGaps({ gaps: G }), G); }); test("gapsOnSegment: on the segment's clock, on the frame grid, clipped", () => { // The segment starts at 101.6 (the lead-in before 102) and runs 16.4 s. const g = gapsOnSegment(G, 101.6, 16.4, 30); assert.deepEqual(g.map((x) => [Math.round(x.from * 30), Math.round(x.to * 30)]), [[102, 162], [252, 267]]); for (const x of g) { assert.ok(Math.abs(x.from * 30 - Math.round(x.from * 30)) < 1e-6 && Math.abs(x.to * 30 - Math.round(x.to * 30)) < 1e-6, "whole frames"); } // A gap past the segment's end is dropped; one cut into is clipped. assert.deepEqual(gapsOnSegment([{ from: 105, to: 107 }], 101.6, 4, 30).map((x) => [Math.round(x.from * 30), Math.round(x.to * 30)]), [[102, 120]], "cut into by the end: clipped"); assert.deepEqual(gapsOnSegment([{ from: 105, to: 107 }], 108, 4, 30), []); }); // ---- the edits ---------------------------------------------------------------- test("editGaps: add (merging what it touches), remove by a second inside, set; parseGapSpec; gapsText", () => { assert.deepEqual(editGaps([], { add: { from: 105, to: 106 } }), [{ from: 105, to: 106 }]); assert.deepEqual(editGaps([{ from: 105, to: 106 }], { add: { from: 105.5, to: 107 } }), [{ from: 105, to: 107 }]); assert.deepEqual(editGaps([{ from: 110, to: 111 }], { add: { from: 105.004, to: 106.006 } }), [{ from: 105, to: 106.01 }, { from: 110, to: 111 }]); assert.deepEqual(editGaps(G, { remove: 106.2 }), [G[1]]); assert.throws(() => editGaps(G, { remove: 108 }), /no gap at 108 \(gaps: 105–107, 110–110.5\)/); assert.throws(() => editGaps([], { add: { from: 3, to: 2 } }), /from < to/); assert.deepEqual(editGaps(G, { set: [] }), []); assert.deepEqual(normalizeGaps([{ from: 110.004, to: 111 }, { from: 105, to: 106.333 }]), [{ from: 105, to: 106.33 }, { from: 110, to: 111 }]); assert.deepEqual(parseGapSpec("12.3-15.1"), { from: 12.3, to: 15.1 }); assert.deepEqual(parseGapSpec(" 12.3 – 15.1 "), { from: 12.3, to: 15.1 }); assert.deepEqual(parseGapSpec("12..13"), { from: 12, to: 13 }); assert.equal(parseGapSpec("15-12"), null); assert.equal(parseGapSpec("12"), null); assert.equal(gapsText({ ...CLIP, gaps: G }), "−105.00–107.00, −110.00–110.50"); assert.equal(GAP_LIMITS.min, 0.2); }); test("a gap's own mark and why (common gapCue.mjs) ride along: kept, checked, edited, never moving its seconds", () => { const own = [{ from: 105, to: 107, mark: false, why: "dead-air" }, { from: 110, to: 110.5 }]; assert.deepEqual(gapsOf({ ...CLIP, gaps: own }), own); assert.deepEqual(gapsOf({ ...CLIP, gaps: [{ from: 105, to: 107, mark: "no", why: "boring", label: "x" }] }), [{ from: 105, to: 107 }], "ill-formed ones are not read"); assert.deepEqual(normalizeGaps([{ from: 105.004, to: 107, why: "other" }]), [{ from: 105, to: 107, why: "other" }]); assert.deepEqual(validateGaps({ ...CLIP, gaps: own }), []); const errs = validateGaps({ ...CLIP, gaps: [{ from: 105, to: 107, mark: "no" }, { from: 110, to: 110.5, why: "boring" }] }, "c1"); assert.deepEqual(errs, ['c1.gaps[0].mark is true (mark its join) or false, not "no"', 'c1.gaps[1].why is one of dead-air, idle, other, not "boring"']); assert.deepEqual(editGaps(own, { edit: { at: 106, mark: true } }), [{ from: 105, to: 107, mark: true, why: "dead-air" }, { from: 110, to: 110.5 }]); assert.deepEqual(editGaps(own, { edit: { at: 106, mark: null, why: null } }), [{ from: 105, to: 107 }, { from: 110, to: 110.5 }]); assert.deepEqual(editGaps(own, { edit: { at: 110.2, why: "other" } })[1], { from: 110, to: 110.5, why: "other" }); assert.throws(() => editGaps(own, { edit: { at: 108, mark: true } }), /no gap at 108/); assert.throws(() => editGaps(own, { edit: { at: 106, why: "boring" } }), /why is dead-air, idle, other or default/); // Its reason (a few words its mark says) and its corner (where its mark stands), lane gap-cue rulings 20 Nov. assert.deepEqual(editGaps(own, { edit: { at: 106, reason: " ad break ", corner: "tr" } })[0], { from: 105, to: 107, mark: false, why: "dead-air", reason: "ad break", corner: "tr" }); assert.deepEqual(editGaps([{ from: 105, to: 107, reason: "x" }], { edit: { at: 106, reason: "" } })[0], { from: 105, to: 107 }, "empty words drop it"); assert.throws(() => editGaps(own, { edit: { at: 106, reason: "a reason far too long for one small mark" } }), /at most 24 characters/); assert.throws(() => editGaps(own, { edit: { at: 106, corner: "middle" } }), /corner is tl, tr, bl, br or default/); assert.match(validateGaps({ ...CLIP, gaps: [{ from: 105, to: 107, reason: "[x]" }] }, "c1").join(), /reason is a few words/); // One line, drawn as written: a tab or other control character is refused (review 1, 1); a % is words. for (const bad of ["a\tb", "a\u2028b", "a\u0000"]) assert.match(validateGaps({ ...CLIP, gaps: [{ from: 105, to: 107, reason: bad }] }, "c1").join(), /no tab or other control character/); assert.deepEqual(validateGaps({ ...CLIP, gaps: [{ from: 105, to: 107, reason: "100% idle" }] }), []); // Adding a gap elsewhere keeps the others' own keys. assert.deepEqual(editGaps(own, { add: { from: 114, to: 115 } })[0], own[0]); }); test("a gap grown over others keeps what they say of themselves: why and reason when all agree, the first corner, mark on if any (review 1, 2)", () => { // One gap grown: all its own settings kept. const one = [{ from: 105, to: 107, mark: true, why: "dead-air", reason: "walks off", corner: "tr" }]; assert.deepEqual(editGaps(one, { add: { from: 106.5, to: 108 } }), [{ from: 105, to: 108, mark: true, why: "dead-air", reason: "walks off", corner: "tr" }]); // Two joined by a span over both: the why they share, no reason (they differ), the first corner, mark on (one is). const two = [{ from: 105, to: 106, mark: false, why: "idle", reason: "a", corner: "bl" }, { from: 107, to: 108, mark: true, why: "idle", reason: "b", corner: "tr" }]; assert.deepEqual(editGaps(two, { add: { from: 105.5, to: 107.5 } }), [{ from: 105, to: 108, mark: true, why: "idle", corner: "bl" }]); // Off only when every one is off; a why one of them lacks is not kept. assert.deepEqual(mergedOwnKeys([{ from: 1, to: 2, mark: false, why: "idle" }, { from: 3, to: 4, mark: false }]), { mark: false }); assert.deepEqual(mergedOwnKeys([{ from: 1, to: 2, mark: false }, { from: 3, to: 4 }]), {}); assert.deepEqual(mergedOwnKeys([]), {}); // A span touching nothing is a plain gap, as ever. assert.deepEqual(editGaps(one, { add: { from: 110, to: 111 } })[1], { from: 110, to: 111 }); }); // ---- the filtergraph ------------------------------------------------------------ test("gapFilterParts: nothing without gaps; trim + concat with a fade at each join with", () => { assert.deepEqual(gapFilterParts({ gaps: [], seconds: 10 }), { parts: [], v: "[0:v]", a: "[0:a]" }); assert.deepEqual(gapFilterParts({ gaps: [], seconds: 10, aIn: "[2:a]" }), { parts: [], v: "[0:v]", a: "[2:a]" }); const g = gapFilterParts({ gaps: [{ from: 2, to: 3 }], seconds: 10 }); assert.equal(g.v, "[gv]"); assert.equal(g.a, "[ga]"); assert.deepEqual(g.parts, [ "[0:v]split=2[gvs0][gvs1]", "[gvs0]trim=start=0:end=2,setpts=PTS-STARTPTS[gvp0]", "[gvs1]trim=start=3:end=10,setpts=PTS-STARTPTS[gvp1]", "[gvp0][gvp1]concat=n=2:v=1:a=0[gv]", "[0:a]asplit=2[gas0][gas1]", `[gas0]atrim=start=0:end=2,asetpts=PTS-STARTPTS,afade=t=out:st=${2 - GAP_FADE}:d=${GAP_FADE}[gap0]`, `[gas1]atrim=start=3:end=10,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=${GAP_FADE}[gap1]`, "[gap0][gap1]concat=n=2:v=0:a=1[ga]", ]); // No picture (a poster stands in): the sound alone. const a = gapFilterParts({ gaps: [{ from: 2, to: 3 }], seconds: 10, vIn: null }); assert.equal(a.v, null); assert.ok(a.parts.every((p) => !p.includes("[0:v]"))); }); const have = ["ffmpeg", "ffprobe"].every((b) => spawnSync(b, ["-version"]).status === 0); test("gapFilterParts on a real clip: the kept seconds, the gap's black and silence gone, picture and sound one length", { skip: !have && "needs ffmpeg" }, () => { const dir = mkdtempSync(path.join(os.tmpdir(), "gaps-graph-")); try { const src = path.join(dir, "src.mp4"); // 6 s of grey picture and a tone; black and silent over 2-3 s (the gap to take out). let r = spawnSync("ffmpeg", [ "-v", "error", "-y", "-f", "lavfi", "-i", "color=c=gray:s=160x90:r=30:d=6", "-f", "lavfi", "-i", "sine=frequency=440:sample_rate=48000:duration=6", "-filter_complex", "[0:v]drawbox=c=black:t=fill:enable='between(t,2,2.99)'[v];[1:a]volume=enable='between(t,2,2.99)':volume=0[a]", "-map", "[v]", "-map", "[a]", "-c:v", "libx264", "-preset", "ultrafast", "-c:a", "aac", src, ]); assert.equal(r.status, 0, String(r.stderr)); const out = path.join(dir, "out.mp4"); const g = gapFilterParts({ gaps: gapsOnSegment([{ from: 2, to: 3 }], 0, 6, 30), seconds: 6 }); r = spawnSync("ffmpeg", [ "-v", "error", "-y", "-ss", "0", "-to", "6", "-i", src, "-filter_complex", g.parts.join(";"), "-map", g.v, "-map", g.a, "-c:v", "libx264", "-preset", "ultrafast", "-r", "30", "-c:a", "aac", "-ar", "48000", out, ]); assert.equal(r.status, 0, String(r.stderr)); const probe = (sel) => Number(spawnSync("ffprobe", ["-v", "error", "-select_streams", sel, "-show_entries", "stream=duration", "-of", "csv=p=0", out]).stdout.toString().trim()); assert.ok(Math.abs(probe("v:0") - 5) <= 1 / 30 + 1e-3, `picture ${probe("v:0")}`); assert.ok(Math.abs(probe("a:0") - 5) <= 0.03, `sound ${probe("a:0")}`); // No black frame left: the darkest frame is the grey. const st = spawnSync("ffmpeg", ["-v", "error", "-i", out, "-vf", "signalstats,metadata=print:key=lavfi.signalstats.YAVG:file=-", "-f", "null", "-"]); const yavg = st.stdout.toString().split("\n").filter((l) => l.includes("YAVG")).map((l) => Number(l.split("=")[1])); assert.ok(yavg.length >= 149, `frames ${yavg.length}`); assert.ok(Math.min(...yavg) > 60, `no black frame: min YAVG ${Math.min(...yavg)}`); // No silence left either: every 100 ms but the join's own fades is loud. const pcmR = spawnSync("ffmpeg", ["-v", "error", "-i", out, "-ac", "1", "-ar", "8000", "-f", "s16le", "-"], { maxBuffer: 1 << 24 }); const pcm = new Int16Array(pcmR.stdout.buffer, pcmR.stdout.byteOffset, Math.floor(pcmR.stdout.length / 2)); for (let k = 1; k < 48; k += 1) { const a = k * 800; let sum = 0; for (let i = a; i < a + 800 && i < pcm.length; i += 1) sum += pcm[i] * pcm[i]; const rms = Math.sqrt(sum / 800); assert.ok(rms > 1000, `loud at ${(k / 10).toFixed(1)} s: ${rms.toFixed(0)}`); } } finally { rmSync(dir, { recursive: true, force: true }); } }); test("fetchPieces: one padded span per kept piece; pieces under a minute apart are one; no gaps is the padded extent", async () => { const { fetchPieces } = await import("./gaps.mjs"); assert.deepEqual(fetchPieces(10, 20, [], { before: 3, after: 2 }), [{ from: 7, to: 22 }]); assert.deepEqual(fetchPieces(1, 20, null, { before: 3, after: 3 }), [{ from: 0, to: 23 }], "never before 0"); assert.deepEqual(fetchPieces(5385, 21812, [{ from: 5400, to: 21800 }], { before: 3, after: 3 }), [{ from: 5382, to: 5403 }, { from: 21797, to: 21815 }]); assert.deepEqual(fetchPieces(100, 300, [{ from: 120, to: 170 }], { before: 3, after: 3 }), [{ from: 97, to: 303 }], "47 s apart: one fetch"); assert.deepEqual( fetchPieces(0, 1000, [{ from: 100, to: 400 }, { from: 410, to: 900 }], { before: 3, after: 3 }), [{ from: 0, to: 103 }, { from: 397, to: 413 }, { from: 897, to: 1003 }], ); }); // ---- the walls, drawn (lane/clip-fixes) ------------------------------------- test("gapWalls: the span, the keep bands at its edges and beside each gap, and the marks no gap may cover", () => { const w = gapWalls({ ...CLIP, gaps: G, muteFrom: 116, claims: [{ id: "a", verdict: "FALSE", at: 104 }, { verdict: "FALSE", at: 112 }] }); assert.deepEqual(w.span, { from: 102, to: 118 }); assert.equal(w.whose, "cut"); assert.deepEqual( w.zones.map((z) => [z.kind, z.from, z.to]), [["keep-start", 102, 102.5], ["keep-end", 117.5, 118], ["keep-gap", 104.5, 105], ["keep-gap", 107, 107.5], ["keep-gap", 109.5, 110], ["keep-gap", 110.5, 111]], ); assert.match(w.zones[0].why, /after the cut's start/); assert.match(w.zones[2].why, /drag into the gap 105–107 to grow it/); assert.deepEqual(w.marks.map((m) => [m.kind, m.at, m.id]), [["mute", 116, null], ["mark", 104, "a"], ["stamp", 112, null]]); assert.match(w.marks[0].why, /can't cover it/); // No cut: the extent, said as the clip's. const x = gapWalls({ type: "clip", id: "x", start: 10, end: 20 }); assert.deepEqual(x.span, { from: 10, to: 20 }); assert.equal(x.whose, "clip"); assert.deepEqual(x.marks, []); }); test("gapWalls and validateGaps agree: a new gap clear of every zone and mark is accepted, one reaching into either is refused", () => { const entry = { ...CLIP, gaps: G, muteFrom: 116, claims: [{ id: "a", verdict: "FALSE", at: 104 }, { verdict: "FALSE", at: 112.6 }] }; const w = gapWalls(entry); // A seeded walk: deterministic, many spans, every edge on the writer's 2 dp grid. let seed = 7; const rand = () => ((seed = (seed * 1103515245 + 12345) % 2147483648) / 2147483648); let checked = 0; for (let i = 0; i < 4000; i += 1) { const a = Number((w.span.from + rand() * (w.span.to - w.span.from)).toFixed(2)); const b = Number((a + 0.2 + rand() * 3).toFixed(2)); if (b > w.span.to) continue; // Touching or overlapping a gap is a merge (editGaps), not a wall: not this test's question. if (G.some((g) => g.to >= a && g.from <= b)) continue; const hitsZone = w.zones.some((z) => a < z.to - 0.02 && b > z.from + 0.02); const nearZone = w.zones.some((z) => (Math.abs(a - z.to) <= 0.02 || Math.abs(b - z.from) <= 0.02)); if (nearZone) continue; // within the writer's 0.02 tolerance of a band's edge const coversMark = w.marks.some((m) => m.at > a && m.at < b); const errs = validateGaps({ ...entry, gaps: normalizeGaps([...G, { from: a, to: b }]) }); assert.equal(errs.length === 0, !hitsZone && !coversMark, `${a}–${b}: ${errs.join("; ") || "accepted"}`); checked += 1; } assert.ok(checked > 500, `checked ${checked}`); });