feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package synastry
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/star/natal"
|
||||
)
|
||||
|
||||
func TestBuildReport(t *testing.T) {
|
||||
a, err := natal.Compute(time.Date(1990, 5, 12, 0, 0, 0, 0, time.UTC), strPtr("12:00"), strPtr("北京"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := natal.Compute(time.Date(1992, 8, 20, 0, 0, 0, 0, time.UTC), strPtr("08:00"), strPtr("上海"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
asOf := time.Date(2026, 8, 2, 0, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
||||
rep, err := BuildReport(a, b, "我", "TA", asOf)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if rep.Summary["love_index"] == nil || rep.Summary["chart_a"] == nil {
|
||||
t.Fatalf("summary incomplete: %#v", rep.Summary)
|
||||
}
|
||||
charts, ok := rep.Summary["charts"].(map[string]any)
|
||||
if !ok {
|
||||
t.Fatal("charts missing")
|
||||
}
|
||||
for _, k := range []string{"compare", "composite", "davison", "marks_me", "marks_other", "overlay",
|
||||
"composite_progressed", "davison_progressed", "marks_progressed"} {
|
||||
if charts[k] == nil {
|
||||
t.Fatalf("missing chart key %s", k)
|
||||
}
|
||||
}
|
||||
if rep.Summary["as_of"] != "2026-08-02" {
|
||||
t.Fatalf("as_of=%v", rep.Summary["as_of"])
|
||||
}
|
||||
if rep.Detail["aspects"] == nil {
|
||||
t.Fatal("detail aspects missing")
|
||||
}
|
||||
cross := CrossAspects(a, b)
|
||||
if len(cross) == 0 {
|
||||
t.Fatal("expected cross aspects")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompositeDeterministic(t *testing.T) {
|
||||
a, err := natal.Compute(time.Date(1990, 5, 12, 0, 0, 0, 0, time.UTC), strPtr("10:30"), strPtr("上海"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := natal.Compute(time.Date(1992, 8, 20, 0, 0, 0, 0, time.UTC), strPtr("08:00"), strPtr("北京"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c1 := CompositeChart(a, b)
|
||||
c2 := CompositeChart(a, b)
|
||||
if c1.Sun.Lon != c2.Sun.Lon || c1.Rise.Sign != c2.Rise.Sign {
|
||||
t.Fatal("composite not deterministic")
|
||||
}
|
||||
}
|
||||
|
||||
func strPtr(s string) *string { return &s }
|
||||
Reference in New Issue
Block a user