// server/templates/render.test.ts import { describe, it, expect } from "vitest"; import { renderTemplate } from "./render.js"; describe("renderTemplate", () => { it("rend check.sh.tpl sans proxy", () => { const out = renderTemplate("apt/check.sh.tpl", { aptProxy: null }); expect(out).toContain("apt-get update -qq"); expect(out).toContain("===SU:SIMULATE==="); expect(out).not.toContain("http_proxy"); }); it("injecte le proxy quand fourni", () => { const out = renderTemplate("apt/check.sh.tpl", { aptProxy: "http://cache:3142" }); expect(out).toContain('http_proxy="http://cache:3142"'); }); it("rend update-analyze.sh.tpl avec les sections attendues", () => { const out = renderTemplate("apt/update-analyze.sh.tpl", { aptProxy: null }); expect(out).toContain("===SU:APT_SIM_DISTUPGRADE==="); expect(out).toContain("apt-mark showhold"); }); });