Files
boss/tests/deployment-caddyfile.test.ts

29 lines
997 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
test("deployment Caddyfile keeps boss and gptpluscontrol routes in a single site definition", async () => {
const source = await readFile(new URL("../deployment/Caddyfile", import.meta.url), "utf8");
assert.match(
source,
/boss\.hyzq\.net\s*\{/,
"expected deployment Caddyfile to define the main boss.hyzq.net site",
);
assert.match(
source,
/handle \/gptpluscontrol\/\* \{\s*reverse_proxy 127\.0\.0\.1:18081\s*\}/s,
"expected deployment Caddyfile to preserve the GPT Plus Control route under the boss domain",
);
assert.match(
source,
/reverse_proxy 127\.0\.0\.1:3000/,
"expected deployment Caddyfile to continue proxying boss-web to port 3000",
);
assert.equal(
(source.match(/^boss\.hyzq\.net\s*\{/gm) ?? []).length,
1,
"expected deployment Caddyfile to avoid duplicate boss.hyzq.net site definitions",
);
});