import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import test from "node:test"; import { homeSurface as page } from "./home-surface.ts"; const sidebar = readFileSync(new URL("../src/components/app-sidebar.tsx", import.meta.url), "utf8"); const overlay = readFileSync(new URL("../src/components/account-dialog-overlay.tsx", import.meta.url), "utf8"); test("account menu exposes the four MVP settings sections", () => { assert.match(sidebar, /个人资料<\/span>/); assert.match(sidebar, /href: "\/people", label: "星盘档案"/); assert.doesNotMatch(sidebar, /星盘资料<\/span>/); assert.match(sidebar, /通用设置<\/span>/); assert.match(sidebar, /账户与点数<\/span>/); assert.match(sidebar, /onOpenGeneral/); }); test("personal profile is limited to account basics and links to chart settings", () => { const profile = readFileSync(new URL("../src/components/profile-panel.tsx", import.meta.url), "utf8"); assert.match(profile, /账户信息/); assert.match(profile, /登录邮箱/); assert.doesNotMatch(profile, /管理星盘资料/); assert.doesNotMatch(profile, / { const charts = readFileSync(new URL("../src/components/people/people-page.tsx", import.meta.url), "utf8"); const form = readFileSync(new URL("../src/components/chart-profile-form.tsx", import.meta.url), "utf8"); const personalProfile = readFileSync(new URL("../src/components/profile-panel.tsx", import.meta.url), "utf8"); // 原值 / 新值 / 原因:已退役面板编辑本人 / 本人账户来源、独立他人保存 / /people 是唯一入口,不伪造已移除的本人编辑。 assert.match(charts, /readProfile\(account\.profile\)/); assert.match(charts, /selectedId && selected\?\.role === "other"/); assert.match(charts, /onSubmit=\{\(event\) => void saveOther\(event\)\}/); assert.doesNotMatch(charts, /setEditingSelfChart/); assert.match(form, /AyanamsaPreferenceField/); assert.doesNotMatch(personalProfile, /AyanamsaPreferenceField/); }); test("the general dialog renders the shared theme preference panel", () => { assert.match(overlay, /dialog: "profile" \| "chart-library" \| "billing" \| "general"/); assert.match(overlay, /renderGeneral: \(\) => ReactNode/); assert.match(overlay, /return model\.renderGeneral\(\)/); assert.match(page, /renderGeneral\(\) \{\s*return ;/); });