Separate YouTube video titles from on-video song/artist fields with Pro gating, serve curated fonts and watermark assets for 1:1 preview parity, and include billing/API/docs/deploy stack for self-hosted release.
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { Plan } from "@prisma/client";
|
|
import {
|
|
resolveBurnedSongTitle,
|
|
resolveYouTubeTitle,
|
|
validateYouTubeTitle,
|
|
} from "../lib/titles";
|
|
|
|
function testYouTubeTitleResolution() {
|
|
assert.equal(
|
|
resolveYouTubeTitle({ title: "My Video", songTitle: "Song", artist: "Artist" }, Plan.FREE),
|
|
"My Video",
|
|
);
|
|
|
|
assert.equal(
|
|
resolveYouTubeTitle({ title: "", songTitle: "Song", artist: "Artist" }, Plan.FREE),
|
|
"",
|
|
);
|
|
|
|
assert.equal(
|
|
resolveYouTubeTitle({ title: "", songTitle: "Song", artist: "Artist" }, Plan.PREMIUM),
|
|
"Artist - Song",
|
|
);
|
|
|
|
assert.equal(
|
|
resolveYouTubeTitle({ title: "Custom", songTitle: "Song", artist: "Artist" }, Plan.PREMIUM),
|
|
"Custom",
|
|
);
|
|
|
|
assert.equal(
|
|
resolveYouTubeTitle({ title: "", songTitle: "Song", artist: "" }, Plan.PREMIUM),
|
|
"Song",
|
|
);
|
|
}
|
|
|
|
function testBurnedSongTitle() {
|
|
assert.equal(resolveBurnedSongTitle({ songTitle: "Track" }), "Track");
|
|
assert.equal(resolveBurnedSongTitle({ title: "YouTube only" }, "Fallback"), "Fallback");
|
|
}
|
|
|
|
function testValidation() {
|
|
assert.equal(validateYouTubeTitle({ title: "Ok" }, Plan.FREE), null);
|
|
assert.ok(validateYouTubeTitle({ title: "" }, Plan.FREE));
|
|
assert.equal(
|
|
validateYouTubeTitle({ title: "", songTitle: "S", artist: "A" }, Plan.PREMIUM),
|
|
null,
|
|
);
|
|
}
|
|
|
|
testYouTubeTitleResolution();
|
|
testBurnedSongTitle();
|
|
testValidation();
|
|
console.log("titles.test.ts: ok");
|