08919752e3
Checkpoint multi-chantiers (arbre vert : tsc 0 erreur, 70 tests, build OK). - tâche 1.9 Phase 1 : schéma socle (machine_state/events/reports/raw_artifacts/ hardware/metrics + colonnes étendues) + wiring refresh/execute. Migration 0002. - tâche 1.9 Phase 2 : machine_credentials + machine_host_keys (non destructif, dual-read + backfill). Migration 0003. Fix séquence journal de migration. - tâche 2 : SJ-0 (types étendus rétro-compatibles, réducteur Docker, resolveTemplate), SJ-1 (update-analyze enrichi), SJ-2 (apply + diff dpkg + timeout inactivité SSH), SJ-3 (reboot vérifié boot_id). - WIP parallèle inclus : /api/capabilities, auth/apiTokens/apiClients, system metrics, scaffold app_rust, ajustements frontend. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
907 B
TypeScript
21 lines
907 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { resolveTemplate } from "./render.js";
|
|
|
|
describe("resolveTemplate", () => {
|
|
it("retombe sur apt/ quand aucun dossier OS spécifique n'existe (fonction exists fournie)", () => {
|
|
const noneExist = () => false;
|
|
expect(resolveTemplate("full-upgrade", "proxmox", noneExist)).toBe("apt/full-upgrade.sh.tpl");
|
|
expect(resolveTemplate("update-analyze", "debian", noneExist)).toBe("apt/update-analyze.sh.tpl");
|
|
});
|
|
|
|
it("choisit le template OS spécifique quand il existe", () => {
|
|
const proxmoxExists = (rel: string) => rel === "proxmox/full-upgrade.sh.tpl";
|
|
expect(resolveTemplate("full-upgrade", "proxmox", proxmoxExists)).toBe("proxmox/full-upgrade.sh.tpl");
|
|
});
|
|
|
|
it("unknown retombe toujours sur apt/", () => {
|
|
const all = () => true;
|
|
expect(resolveTemplate("clean", "unknown", all)).toBe("apt/clean.sh.tpl");
|
|
});
|
|
});
|