落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
815 B
Go
33 lines
815 B
Go
package fortune
|
|
|
|
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"])
|
|
}
|
|
}
|