Homepage no longer waits on /api/onboarding for six starter questions. Natal answers show the spoken layer first; the Level 2 skeleton sits in a collapsed 完整分析 block. Wide tables scroll sideways on a phone. Form inputs are 16px so iOS does not zoom on focus.
73 lines
3.2 KiB
TypeScript
73 lines
3.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
import { bootstrapPrepareSettled } from "../src/lib/home-bootstrap.ts";
|
|
|
|
const page = readFileSync(new URL("../src/app/page.tsx", import.meta.url), "utf8");
|
|
const starterHome = readFileSync(new URL("../src/components/starter-home.tsx", import.meta.url), "utf8");
|
|
const bootstrap = readFileSync(new URL("../src/lib/home-bootstrap.ts", import.meta.url), "utf8");
|
|
const entrypoint = readFileSync(new URL("../src/lib/consultation-entrypoint.ts", import.meta.url), "utf8");
|
|
const srcFiles = [
|
|
page,
|
|
starterHome,
|
|
readFileSync(new URL("../src/hooks/use-profile-onboarding.ts", import.meta.url), "utf8"),
|
|
readFileSync(new URL("../src/mastra/index.ts", import.meta.url), "utf8"),
|
|
];
|
|
|
|
test("the homepage no longer renders theme cards", () => {
|
|
assert.doesNotMatch(starterHome, /starter-themes|starter-theme-card|starter-theme-accordion|starter-themes-heading/);
|
|
assert.doesNotMatch(starterHome, /从一个主题开始/);
|
|
assert.doesNotMatch(starterHome, /starterThemes|starterSuggestions|onboardingError/);
|
|
assert.match(starterHome, /className="starter-hero"/);
|
|
assert.match(starterHome, /className="product-entrypoints"/);
|
|
});
|
|
|
|
test("the homepage no longer requests /api/onboarding", () => {
|
|
for (const source of srcFiles) {
|
|
assert.doesNotMatch(source, /\/api\/onboarding/);
|
|
assert.doesNotMatch(source, /requestOnboardingWithRecovery/);
|
|
assert.doesNotMatch(source, /getOnboardingAgent/);
|
|
}
|
|
assert.doesNotMatch(page, /fetch\("\/api\/onboarding"/);
|
|
});
|
|
|
|
test("bootstrap prepare no longer waits on onboarding suggestions", () => {
|
|
assert.doesNotMatch(bootstrap, /onboardingSettled|profileComplete/);
|
|
assert.doesNotMatch(page, /onboardingSettled/);
|
|
assert.equal(bootstrapPrepareSettled({
|
|
dailyStarlanguageApplicable: true,
|
|
dailyStarlanguageSettled: true,
|
|
entrySummarySettled: true,
|
|
}), true);
|
|
assert.equal(bootstrapPrepareSettled({
|
|
dailyStarlanguageApplicable: true,
|
|
dailyStarlanguageSettled: false,
|
|
entrySummarySettled: true,
|
|
}), false);
|
|
});
|
|
|
|
test("StarterHome no longer receives suggestion props", () => {
|
|
assert.doesNotMatch(starterHome, /starterThemes|starterSuggestions|startSuggestedConsultation|onboardingError/);
|
|
assert.doesNotMatch(page, /starterThemes=\{|starterSuggestions=\{|onboardingError=\{/);
|
|
assert.match(page, /startSuggestedConsultation\(/);
|
|
assert.match(page, /startDailyStarlanguageConsultation/);
|
|
});
|
|
|
|
test("guided_topic remains readable for history but has no homepage emit point", () => {
|
|
assert.match(entrypoint, /入口已于 2026-09-15 下线,枚举值保留用于读回历史会话/);
|
|
assert.match(entrypoint, /"guided_topic"/);
|
|
assert.doesNotMatch(starterHome, /guided_topic/);
|
|
assert.doesNotMatch(page, /"guided_topic"/);
|
|
});
|
|
|
|
test("the empty home is greeting, two product cards, and the composer", () => {
|
|
const start = starterHome.indexOf('<div className="starter-list starter-workbench"');
|
|
const home = starterHome.slice(start);
|
|
assert.match(home, /starter-hero/);
|
|
assert.match(home, /daily-starlanguage-card/);
|
|
assert.match(home, /birth-rectification-card/);
|
|
assert.doesNotMatch(home, /starter-theme/);
|
|
assert.match(page, /composer-wrap-starter/);
|
|
});
|