Files
DeepTutor/web/tests/watching-citations.test.ts
Bingxi Zhao (Frank) 3dc372f551 release: v1.6.2 — immersive watching and extensible visualizers
Add synchronized YouTube learning, a plugin-driven visualizer catalog, and Hermes, OpenClaw, and DeepSeek agent harnesses. Refresh Reading, Knowledge, Partner status, guided updates, documentation, translations, and release notes for v1.6.2.
2026-08-31 01:13:07 +08:00

28 lines
831 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import {
linkifyVideoTimestamps,
videoTimeFromHref,
} from "../lib/watching-citations";
test("linkifies minute and hour timestamp citations", () => {
assert.equal(
linkifyVideoTimestamps("See [01:23] and [1:02:03]."),
"See [01:23](#dt-video-time-83) and [1:02:03](#dt-video-time-3723).",
);
});
test("does not rewrite code or existing links", () => {
assert.equal(
linkifyVideoTimestamps("`[01:23]` [01:23](https://example.test)"),
"`[01:23]` [01:23](https://example.test)",
);
});
test("parses only valid video seek anchors", () => {
assert.equal(videoTimeFromHref("#dt-video-time-83"), 83);
assert.equal(videoTimeFromHref("https://example.test"), null);
assert.equal(videoTimeFromHref("#dt-video-time-nope"), null);
});