feat(ECR-012–016): 合规、题库、时辰刷新、头像、MBTI OEJTS 与埋点

落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 01:27:58 +08:00
co-authored by Cursor
parent 13860bf1ef
commit 89756f65b4
227 changed files with 7405 additions and 1407 deletions
+54 -1
View File
@@ -1,6 +1,9 @@
package home
import "testing"
import (
"testing"
"time"
)
func TestNormalizeToolOK(t *testing.T) {
b := "热"
@@ -28,3 +31,53 @@ func TestNormalizeToolRejects(t *testing.T) {
}
}
}
func TestFallbackTipsChangeByDay(t *testing.T) {
loc := time.FixedZone("CST", 8*3600)
d1 := time.Date(2026, 8, 11, 19, 0, 0, 0, loc)
d2 := time.Date(2026, 8, 12, 19, 0, 0, 0, loc)
a := fallbackTips(d1, "1990-05-12", nil)
b := fallbackTips(d2, "1990-05-12", nil)
if a.ClothingIndex == b.ClothingIndex && a.Clothing == b.Clothing && a.Wellness == b.Wellness {
t.Fatalf("expected day-varying tips, got same %+v", a)
}
if a.AsOf == b.AsOf {
t.Fatalf("as_of should differ: %s", a.AsOf)
}
}
func TestCurrentShichenBoundaries(t *testing.T) {
loc := time.FixedZone("CST", 8*3600)
cases := []struct {
h, wantIdx int
wantName string
}{
{23, 0, "子"},
{0, 0, "子"},
{9, 5, "巳"},
{10, 5, "巳"},
{11, 6, "午"},
}
for _, c := range cases {
now := time.Date(2026, 8, 12, c.h, 15, 0, 0, loc)
w := CurrentShichen(now)
if w.Index != c.wantIdx || w.Name != c.wantName {
t.Fatalf("h=%d got %d %s want %d %s", c.h, w.Index, w.Name, c.wantIdx, c.wantName)
}
if !w.Start.Before(now) && !w.Start.Equal(now) {
t.Fatalf("start should be <= now: %v %v", w.Start, now)
}
if !w.End.After(now) {
t.Fatalf("end should be > now")
}
}
}
func TestFallbackTipsChangeByShichen(t *testing.T) {
loc := time.FixedZone("CST", 8*3600)
a := fallbackTips(time.Date(2026, 8, 12, 9, 0, 0, 0, loc), "1990-05-12", nil)
b := fallbackTips(time.Date(2026, 8, 12, 11, 0, 0, 0, loc), "1990-05-12", nil)
if a.Clothing == b.Clothing && a.Wellness == b.Wellness && a.ClothingIndex == b.ClothingIndex {
t.Fatalf("expected shichen-varying tips")
}
}