51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
|
|
const authHelpPagePath = new URL("../src/app/auth/help/page.tsx", import.meta.url);
|
|
const loginPagePath = new URL("../src/app/auth/login/page.tsx", import.meta.url);
|
|
const enterpriseLoginShellPath = new URL(
|
|
"../src/components/enterprise-admin-login-shell.tsx",
|
|
import.meta.url,
|
|
);
|
|
const securityPagePath = new URL("../src/app/me/security/page.tsx", import.meta.url);
|
|
const bossDataPath = new URL("../src/lib/boss-data.ts", import.meta.url);
|
|
|
|
async function readSource(path: URL) {
|
|
return readFile(path, "utf8");
|
|
}
|
|
|
|
test("auth-facing pages do not advertise temporary auto login", async () => {
|
|
const sources = await Promise.all([
|
|
readSource(authHelpPagePath),
|
|
readSource(loginPagePath),
|
|
readSource(securityPagePath),
|
|
]);
|
|
const combined = sources.join("\n");
|
|
|
|
assert.doesNotMatch(combined, /免验证|一键进入|直接创建最高管理员会话/);
|
|
assert.match(combined, /账号密码/);
|
|
assert.match(combined, /验证码/);
|
|
assert.match(combined, /krisolo/);
|
|
});
|
|
|
|
test("web login page uses the enterprise admin visual shell", async () => {
|
|
const source = [
|
|
await readSource(loginPagePath),
|
|
await readSource(enterpriseLoginShellPath),
|
|
].join("\n");
|
|
|
|
assert.match(source, /EnterpriseAdminLoginShell/);
|
|
assert.match(source, /Boss 企业管理后台/);
|
|
assert.match(source, /登录企业后台/);
|
|
assert.match(source, /仅限授权管理员访问/);
|
|
assert.match(source, /平台级权限/);
|
|
});
|
|
|
|
test("seeded OTA release notes do not describe login as one-click entry", async () => {
|
|
const source = await readSource(bossDataPath);
|
|
|
|
assert.doesNotMatch(source, /登录页改为原生一键进入/);
|
|
assert.match(source, /登录页改为原生账号登录/);
|
|
});
|