Files
digital-psychology/apps/api/internal/yijing/seed_test.go
T
jackyu66gitandCursor 89756f65b4 feat(ECR-012–016): 合规、题库、时辰刷新、头像、MBTI OEJTS 与埋点
落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 01:27:58 +08:00

30 lines
890 B
Go

package yijing
import (
"testing"
"time"
)
func TestSeedStableSameInputs(t *testing.T) {
bt := "10:30"
now := time.Date(2026, 8, 11, 19, 0, 0, 0, time.FixedZone("CST", 8*3600))
a := Seed("1990-05-12", &bt, now)
b := Seed("1990-05-12", &bt, now)
if a.GuaIndex != b.GuaIndex || a.GuaName != b.GuaName || a.Line != b.Line {
t.Fatalf("expected stable seed, got %+v vs %+v", a, b)
}
if a.GuaIndex < 1 || a.GuaIndex > 64 {
t.Fatalf("gua out of range: %d", a.GuaIndex)
}
}
func TestSeedChangesWithDay(t *testing.T) {
d1 := time.Date(2026, 8, 11, 19, 0, 0, 0, time.FixedZone("CST", 8*3600))
d2 := time.Date(2026, 8, 12, 19, 0, 0, 0, time.FixedZone("CST", 8*3600))
a := Seed("1990-05-12", nil, d1)
b := Seed("1990-05-12", nil, d2)
if a.GuaIndex == b.GuaIndex && a.Line == b.Line {
t.Fatalf("expected seed to change across days, both gua=%d line=%d", a.GuaIndex, a.Line)
}
}