mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 06:20:13 +08:00
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.
28 lines
831 B
TypeScript
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);
|
|
});
|