Files
Jyotisha/frontend/tests/settings-mvp-contract.test.ts
T
jesse-uxandClaude Code 4d801e53c3
Independent Staging Quality Gate / validate (push) Successful in 16m28s
Independent Staging Quality Gate / publish (push) Successful in 3m33s
fix: integrate people archive, report reader and western chart corrections
Validate on Linux Node 22 and PostgreSQL 17: 3894 frontend tests and 64 database tests pass, with no removed test names or new failures. Preserve static Home, bounded gzip, assertion-change records and manual acceptance gaps.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-25 20:41:16 +08:00

46 lines
2.5 KiB
TypeScript

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>个人资料<\/span>/);
assert.match(sidebar, /href: "\/people", label: "星盘档案"/);
assert.doesNotMatch(sidebar, /<span>星盘资料<\/span>/);
assert.match(sidebar, /<span>通用设置<\/span>/);
assert.match(sidebar, /<span>账户与点数<\/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, /<ProfileFields/);
assert.doesNotMatch(profile, /出生资料/);
});
test("the chart library owns self-profile editing and keeps other-chart save separate", () => {
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 <ThemePreferencePanel \/>;/);
});