import { test } from "node:test"; import assert from "node:assert/strict"; import { voiceCredit } from "./voice-credit.mjs"; test("a generated voice is credited to the vendor that made it, not always HeyGen", () => { assert.equal(voiceCredit([{ id: "01" }], "elevenlabs"), "Voice: AI-generated by ElevenLabs"); assert.equal(voiceCredit([{ id: "01" }], "gemini"), "Voice: AI-generated by Google Gemini"); assert.equal(voiceCredit([{ id: "01" }], "heygen"), "Voice: AI-generated by HeyGen"); }); test("a recording is credited as the person's own, and a mix names both", () => { assert.equal(voiceCredit([{ source: "recording" }], "recording"), "Voice: your own recording"); assert.equal( voiceCredit([{ source: "recording" }, { id: "02" }], "kokoro"), "Voice: your own recording; AI-generated by Kokoro (open-source, run locally)", ); }); test("no voices, no credit", () => { assert.equal(voiceCredit([], null), null); });