import { describe, it, expect } from "vitest"; import { conventionalNames, autoShotThumbnailEnabled } from "./project-templates"; /** * The convention has to reproduce UNG's existing comp names exactly, or * enabling per-project templates would silently break the show it was built * for: every findComp in the panel resolves through it. */ describe("conventionalNames", () => { it("reproduces UNG's existing template names", () => { expect(conventionalNames("UNG")).toEqual({ overlayComp: "UNG_VFX_OVERLAY", previewComp: "UNG_EXPORT_TEMPLATE", lutComp: "_SHOW LUT", }); }); it("derives names for a show with a longer id", () => { const names = conventionalNames("DH2_VFX"); expect(names.overlayComp).toBe("DH2_VFX_VFX_OVERLAY"); expect(names.previewComp).toBe("DH2_VFX_EXPORT_TEMPLATE"); }); it("keeps the LUT comp name constant across shows", () => { // What differs between shows is the LUT inside the comp, which is why the // template AEP is per-project rather than the comp name. expect(conventionalNames("SNV").lutComp).toBe("_SHOW LUT"); expect(conventionalNames("QTK").lutComp).toBe("_SHOW LUT"); }); it("falls back to a placeholder rather than producing _VFX_OVERLAY", () => { expect(conventionalNames("").overlayComp).toBe("SHOW_VFX_OVERLAY"); }); }); /** * The flag decides whether finished renders start writing shot thumbnails, so * anything short of an explicit `true` has to leave shots alone — a malformed * config in particular, which must not be read as consent. */ describe("autoShotThumbnailEnabled", () => { it("is on only when explicitly enabled", () => { expect(autoShotThumbnailEnabled({ pipelineConfig: { autoShotThumbnail: true } })).toBe(true); }); it("defaults to off", () => { expect(autoShotThumbnailEnabled({ pipelineConfig: {} })).toBe(false); expect(autoShotThumbnailEnabled({ pipelineConfig: null })).toBe(false); expect(autoShotThumbnailEnabled({})).toBe(false); expect(autoShotThumbnailEnabled({ pipelineConfig: { autoShotThumbnail: false } })).toBe(false); }); it("stays off when the config is malformed", () => { expect(autoShotThumbnailEnabled({ pipelineConfig: { autoShotThumbnail: "yes" } })).toBe(false); expect(autoShotThumbnailEnabled({ pipelineConfig: "not an object" })).toBe(false); }); it("does not disturb the other settings it shares a column with", () => { const cfg = { pipelineConfig: { templateAep: "X:/show.aep", autoShotThumbnail: true } }; expect(autoShotThumbnailEnabled(cfg)).toBe(true); }); });