import assert from "node:assert/strict";
import {
  resolveBurnedSongTitle,
  resolveYouTubeTitle,
  validateYouTubeTitle,
} from "../lib/titles";

assert.equal(
  resolveYouTubeTitle({ title: "My Video", songTitle: "Song", artist: "Artist" }),
  "My Video",
);
assert.equal(
  resolveYouTubeTitle({ title: "", songTitle: "Song", artist: "Artist" }),
  "Artist - Song",
);
assert.equal(resolveYouTubeTitle({ title: "", songTitle: "Song" }), "Song");
assert.equal(resolveBurnedSongTitle({ songTitle: "Track" }), "Track");
assert.equal(resolveBurnedSongTitle({ title: "YouTube only" }, "Fallback"), "Fallback");
assert.equal(validateYouTubeTitle({ title: "Ok" }), null);
assert.ok(validateYouTubeTitle({ title: "" }));
assert.equal(validateYouTubeTitle({ title: "", songTitle: "S", artist: "A" }), null);

console.log("titles.test.ts: ok");
