Files
demat-facturation/server/deploymentRouting.test.ts

30 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
describe("routage et persistance de déploiement", () => {
it("utilise le domaine fourni par lenvironnement avec la recette comme repli", () => {
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
expect(composeFile).toContain(
"Host(`${APP_DOMAIN:-demat-facturation.recette.santinova-soft.org}`)"
);
expect(composeFile).toContain("source: demat_facturation_storage");
expect(composeFile).toContain("target: /app/storage");
});
it("refuse de recréer le volume PDF et contrôle son montage avant le démarrage", () => {
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
const dockerfile = readFileSync(join(process.cwd(), "Dockerfile"), "utf8");
const guardScript = readFileSync(join(process.cwd(), "scripts", "ensure-storage-volume.sh"), "utf8");
expect(composeFile).toContain("STORAGE_BASE_PATH: /app/storage");
expect(composeFile).toContain("external: true");
expect(composeFile).toContain("nocopy: true");
expect(composeFile).toContain("grep -qs ' /app/storage ' /proc/mounts");
expect(dockerfile).toContain('CMD ["/app/scripts/ensure-storage-volume.sh"]');
expect(guardScript).toContain("Volume persistant non monté");
expect(guardScript).toContain("/proc/mounts");
});
});