Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.
Python ai-toolsauto-captionscaptionscliffmpegmcpmcp-serveropusclip-alternativepodcast-clipspodcastsshortform-videovertical-videowhisper
import { describe, it, expect, vi } from "vitest";
import type { TaskExecutor } from "./python-executor.js";
import { resolveTranscribeEngine, engineCanDiarize } from "./engine-resolve.js";
function fakeExecutor(response: { data: { engine: string } }): TaskExecutor {
return { execute: vi.fn().mockResolvedValue(response) };
}
function failingExecutor(): TaskExecutor {
return { execute: vi.fn().mockRejectedValue(new Error("boom")) };
}
describe("resolveTranscribeEngine", () => {
it("returns what the backend predicts it will resolve to", async () => {
const executor = fakeExecutor({ data: { engine: "whispercpp" } });
const engine = await resolveTranscribeEngine(executor, undefined, "base");
expect(engine).toBe("whispercpp");
expect(executor.execute).toHaveBeenCalledWith("resolve_transcribe_engine", {
engine: undefined,
model_size: "base",
});
});
it("passes an explicit engine through for the backend to normalize", async () => {
const executor = fakeExecutor({ data: { engine: "assemblyai" } });
const engine = await resolveTranscribeEngine(executor, "assemblyai", "base");
expect(engine).toBe("assemblyai");
});
it("falls back to the raw request if resolution itself fails", async () => {
const executor = failingExecutor();
const engine = await resolveTranscribeEngine(executor, "whisper-py", "base");
expect(engine).toBe("whisper-py");
});
it("falls back to whisper-py when both the request and the resolution are empty", async () => {
const executor = failingExecutor();
const engine = await resolveTranscribeEngine(executor, undefined, "base");
expect(engine).toBe("whisper-py");
});
});
describe("engineCanDiarize", () => {
it("is false for whisper.cpp and omnilingual, which never diarize", () => {
expect(engineCanDiarize("whispercpp")).toBe(false);
expect(engineCanDiarize("omnilingual")).toBe(false);
});
it("is true for whisper-py and assemblyai", () => {
expect(engineCanDiarize("whisper-py")).toBe(true);
expect(engineCanDiarize("assemblyai")).toBe(true);
});
it("is true (the safe default) for an unresolved engine", () => {
expect(engineCanDiarize(undefined)).toBe(true);
});
});