Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 92dc63362577948c330a0ab6614164fb1f056eb4
parent c466374c489a17c82d749ac36d679ffc34f9b70c
Author: Autistic Integrity <contributor@invalid>
Date:   Wed, 11 Nov 2026 12:55:33 -0500

vtt tests: short timestamps, mixed forms, long hours, short rolling tags, point cues

The contributed tests for short-form WebVTT timings, as received.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mcommon/lib/vtt.test.ts | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/common/lib/vtt.test.ts b/common/lib/vtt.test.ts @@ -95,3 +95,33 @@ test("parseVtt reads cue identifiers and settings as structure, not text", () => { start: 3, end: 4, text: "Second line" }, ]); }); + +// Regression: short FFmpeg timestamps previously produced zero index cues. +// Test numeric seconds, not just cue counts, to catch unit/field shifts. +test("parseVtt accepts short timestamps, mixed forms, settings, and CRLF", () => { + const src = "WEBVTT\r\n\r\n1\r\n00:00.250 --> 00:01.910 line:90%\r\nFirst\r\n\r\n" + + "2\r\n59:59.500 --> 01:00:01.250\r\nBoundary\r\n"; + assert.deepEqual(parseVtt(src), [ + { start: 0.25, end: 1 + 910 / 1000, text: "First" }, + { start: 3599.5, end: 3601.25, text: "Boundary" }, + ]); +}); +test("parseVtt accepts hours longer than two digits", () => { + assert.deepEqual(parseVtt("WEBVTT\n\n100:00:01.000 --> 100:00:02.000\nLong recording\n"), + [{ start: 360001, end: 360002, text: "Long recording" }]); +}); +test("short inline timing retains rolling-caption classification and strips timing tags", () => { + const src = "WEBVTT\n\n00:01.000 --> 00:02.000\n<00:01.000><c>Hello</c> <00:01.500><c>world</c>\n\n" + + "00:02.000 --> 00:02.010\nHello world\n"; + assert.equal(hasWordTiming(src), true); + assert.deepEqual(parseVtt(src), [{ start: 1, end: 2, text: "Hello world" }]); +}); +test("timing lines do not partially match malformed or out-of-range stamps", () => { + for (const stamp of ["00:60.000", "60:00.000", "00:00:60.000", "-00:01.000", "x00:01.000", "00:01.0000"]) { + assert.deepEqual(parseVtt(`WEBVTT\n\n${stamp} --> 00:02.000\nInvalid\n`), [], stamp); + } +}); +test("point cues preserve original text and timestamps", () => { + assert.deepEqual(parseVtt("WEBVTT\n\n00:01.000 --> 00:01.000\nPoint\n"), + [{ start: 1, end: 1, text: "Point" }]); +});