Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/scripts/build-web-surfaces.test.mjs
T

23 lines
1.0 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { describe, it } from "vitest";
const scriptSource = fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "build-web-surfaces.mjs"), "utf8");
describe("build-web-surfaces", () => {
it("builds Core and Customer Portal as separate React Router surfaces", () => {
assert.match(scriptSource, /\["core", "portal"\]/);
assert.match(scriptSource, /HIVEGRID_RUNTIME_SURFACE:\s*surface/);
assert.match(scriptSource, /surface === "portal"[\s\S]*?"hivegrid-portal"/);
assert.match(scriptSource, /process\.env\.VITE_OTEL_SERVICE_NAME \|\| "hivegrid-web"/);
assert.match(scriptSource, /reactRouterCli,\s*"build",\s*"\."/);
});
it("runs the builds sequentially and fails on either non-zero exit", () => {
assert.match(scriptSource, /for \(const surface[\s\S]+await runReactRouterBuild\(surface\)/);
assert.match(scriptSource, /React Router \$\{surface\} build failed/);
});
});