Files
Jyotisha/frontend/tests/birth-sky-test-support.ts
T
Jesse_ChenandClaude Opus 5.5 dec36bce01 feat(birth-sky): poster-only dialog, date/time/city caption, slower reveal, paywall on first refused send (P1–P5, BUG-1080)
TASK-birth-sky-polish-20260928.
- P1: chart page dialog shows only the picture on a dimmed stage, 「保存图片」 below, icon × in the corner.
- P2: BFF returns one server-built `caption` (「1994年5月18日 07:40 · 杭州」); printed under the fact line in all three places; adopted time adds 「 · 校正后」.
- P3: convergence 3 s + words 2.5 s + fade 1 s; settled frame still equals the exported cover.
- P4: redeem paywall no longer opens when the starter home appears; first send refused for credits opens it, later ones open billing; convergence dialog portalled to <body>. BUG-1080 investigating (Chrome repro rules out the overlay covering the convergence).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-09-29 00:03:46 +08:00

26 lines
1.3 KiB
TypeScript

import { readFileSync } from "node:fs";
import { birthSkyCaption } from "../src/lib/birth-sky/caption.ts";
import { birthSkyFromEngine, type BirthSkyOk, type BirthSkyPhase } from "../src/lib/birth-sky/contract.ts";
/** Real engine responses (scripts/generate_birth_sky_golden.py), fictional sample birth. */
export const birthSkyGolden = JSON.parse(
readFileSync(new URL("./fixtures/birth-sky-golden.json", import.meta.url), "utf8"),
) as { times: Record<BirthSkyPhase, string>; responses: Record<BirthSkyPhase, Record<string, unknown>> };
/** Fictional sample place label, in the China picker's `省 · 市 · 区` shape. */
export const GOLDEN_PLACE_LABEL = "浙江省 · 杭州市 · 西湖区";
/** The caption the BFF would build for the fictional sample at this phase's time. */
export function goldenCaption(phase: BirthSkyPhase): string {
const caption = birthSkyCaption({ date: "1994-05-18", time: birthSkyGolden.times[phase], placeLabel: GOLDEN_PLACE_LABEL });
if (!caption) throw new Error(`golden ${phase} has no caption`);
return caption;
}
export function goldenSky(phase: BirthSkyPhase, timeBasis: BirthSkyOk["timeBasis"] = "reported"): BirthSkyOk {
const sky = birthSkyFromEngine(birthSkyGolden.responses[phase], timeBasis, goldenCaption(phase));
if (!sky) throw new Error(`golden ${phase} does not satisfy the contract`);
return sky;
}