Files
boss/tests/auth-pages-copy.test.ts

34 lines
1.2 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 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("seeded OTA release notes do not describe login as one-click entry", async () => {
const source = await readSource(bossDataPath);
assert.doesNotMatch(source, /登录页改为原生一键进入/);
assert.match(source, /登录页改为原生账号登录/);
});