Files
boss/tests/admin-web-static-route.test.ts

24 lines
938 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
async function readSource(path: string) {
return readFile(new URL(path, import.meta.url), "utf8");
}
test("enterprise admin route gates static Vue admin behind highest_admin", async () => {
const source = await readSource("../src/app/enterprise-admin/page.tsx");
assert.match(source, /requirePageSession/);
assert.match(source, /session\.role\s*!==\s*["']highest_admin["']/);
assert.match(source, /redirect\(["']\/admin-web\/index\.html["']\)/);
});
test("independent admin build publishes static assets under Next public admin-web", async () => {
const source = await readSource("../apps/boss-admin-web/vite.config.ts");
assert.match(source, /base:\s*["']\/admin-web\/["']/);
assert.match(source, /outDir:\s*["']\.\.\/\.\.\/public\/admin-web["']/);
assert.match(source, /emptyOutDir:\s*true/);
});