Files
Jyotisha/frontend/tests/birth-time-assessment-loading.test.ts
T
2026-07-19 14:51:06 +08:00

22 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
test("onboarding keeps the current card visible while birth-time assessment is pending", () => {
// Given: saving the selected time can span profile persistence and assessment requests.
const source = [
readFileSync(new URL("../src/app/page.tsx", import.meta.url), "utf8"),
readFileSync(new URL("../src/components/birth-time-assessment-overlay.tsx", import.meta.url), "utf8"),
].join("\n");
// When: the UI enters either pending phase.
// Then: the current form stays mounted and exposes one busy status surface.
assert.match(source, /birthTimeAssessmentPhase/);
assert.match(source, /const onboardingCardReady = presetMessageFinished \|\| birthTimeAssessmentPhase !== null/);
assert.match(source, /onboardingStep === "birth" && onboardingCardReady/);
assert.match(source, /onboardingStep === "place" && onboardingCardReady/);
assert.match(source, /className="birth-time-assessment-overlay"/);
assert.match(source, /aria-busy=\{birthTimeAssessmentPhase !== null\}/);
assert.match(source, /previewMode === "birth-time-assessment-loading"/);
});