Files
nekonest-cloud/tests/beta-policy-controls.test.mjs

29 lines
1.6 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
test("does not expose an unimplemented free-beta grace-period control", async () => {
const [actions, route, repository, bootstrap, billing, contract, stateModel] = await Promise.all([
readFile(new URL("../app/admin/AdminActions.tsx", import.meta.url), "utf8"),
readFile(new URL("../app/api/admin/beta/route.ts", import.meta.url), "utf8"),
readFile(new URL("../db/repository.ts", import.meta.url), "utf8"),
readFile(new URL("../db/bootstrap.ts", import.meta.url), "utf8"),
readFile(new URL("../app/dashboard/billing/page.tsx", import.meta.url), "utf8"),
readFile(new URL("../docs/commercial-contract.md", import.meta.url), "utf8"),
readFile(new URL("../docs/state-model.md", import.meta.url), "utf8"),
]);
const setPublicBeta = repository.slice(
repository.indexOf("export async function setPublicBeta"),
repository.indexOf("export async function createExemption"),
);
assert.doesNotMatch(actions, /graceDays|宽限天数/);
assert.doesNotMatch(route, /graceDays/);
assert.doesNotMatch(setPublicBeta, /input\.graceDays|invalid_grace/);
assert.match(setPublicBeta, /grace_days: 0/);
assert.match(bootstrap, /NULL, 0, 'system:seed'/);
assert.match(actions, /不自动断开既有主机/);
assert.match(billing, /新配对和未完成认领停止,既有主机不自动断开/);
assert.match(contract, /当前没有可配置的宽限天数或隐藏倒计时/);
assert.match(stateModel, /不参与资格、设备认证或页面判断/);
});