Files
digital-psychology/apps/api/internal/star/outlook/outlook_test.go
T
jackyu66gitandCursor 19d3cd5945 refactor(ECR-001): 接入 ESS 并完成结构对齐 Phase A–E
绑定 ESS 双轨治理,拆分超大 H5 页与 Go 引擎,抽出 membership 服务,
并将 star/fortune 重命名为 outlook(JSON 双写兼容);同时修复 /psy API 代理与首页 + 菜单层级。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 17:51:40 +08:00

33 lines
815 B
Go

package outlook
import (
"testing"
"time"
"github.com/yuxingu/digital-psychology/apps/api/internal/star/natal"
)
func TestBuildPeriods(t *testing.T) {
chart, err := natal.Compute(time.Date(1990, 5, 12, 0, 0, 0, 0, time.UTC), nil, nil)
if err != nil {
t.Fatal(err)
}
asOf := time.Date(2026, 8, 2, 0, 0, 0, 0, time.UTC)
a := Build(chart, asOf)
b := Build(chart, asOf)
if a.Daily.Score != b.Daily.Score || a.Yearly.Tip != b.Yearly.Tip {
t.Fatal("not deterministic")
}
if a.Daily.Score < 50 || a.Weekly.Dims["love"] == 0 {
t.Fatalf("bad scores %+v", a.Daily)
}
m := a.AsMap()
if m["monthly"] == nil || m["lifetime"] == nil {
t.Fatal("missing monthly or lifetime")
}
tr, ok := m["transits"].([]map[string]any)
if !ok || len(tr) == 0 {
t.Fatalf("transits missing: %#v", m["transits"])
}
}