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, /星盘资料<\/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/chart-library-panel.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"); // 原值: 编辑本人资料 + setEditingSelfChart(true) + 无条件表单 // 新值: 列表→详情;本人详情标题「编辑本人星盘」;视图状态在面板内 // 原因: 决策 4,列表是列表 assert.match(charts, /编辑本人星盘/); assert.match(charts, /onSubmit=\{saveProfile\}/); assert.match(charts, /onSubmit=\{saveOtherChart\}/); 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 ;/); });