feat(ECR-011): 昵称、首页贴士与档案 Self 唯一/合盘交叉校验
每账号仅一条 self(migration 40902);合盘只选 TA;账号昵称可改;首页穿衣/颜色/养生贴士。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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 TestSeedChangesWithHour(t *testing.T) {
|
||||
now1 := time.Date(2026, 8, 11, 9, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
||||
now2 := time.Date(2026, 8, 11, 18, 0, 0, 0, time.FixedZone("CST", 8*3600))
|
||||
a := Seed("1990-05-12", nil, now1)
|
||||
b := Seed("1990-05-12", nil, now2)
|
||||
if a.DayPart == b.DayPart {
|
||||
t.Fatalf("expected different day parts, both %s", a.DayPart)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user