落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。 Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package explore
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/yuxingu/digital-psychology/apps/api/internal/repository"
|
|
)
|
|
|
|
func TestCatalogHasScaleBankNearTop(t *testing.T) {
|
|
cats := Catalog()
|
|
if len(cats) < 2 {
|
|
t.Fatal("expected categories")
|
|
}
|
|
if cats[1].Key != "tests" || cats[1].Title != "量表题库" {
|
|
t.Fatalf("second cat=%#v want 量表题库", cats[1])
|
|
}
|
|
if len(cats[1].Items) < 5 {
|
|
t.Fatalf("expected scale items, got %d", len(cats[1].Items))
|
|
}
|
|
}
|
|
|
|
func TestWithPublishedScalesReplacesItems(t *testing.T) {
|
|
cats := Catalog()
|
|
out := WithPublishedScales(cats, nil)
|
|
if len(out[1].Items) < 5 {
|
|
t.Fatal("nil scales should keep defaults")
|
|
}
|
|
out = WithPublishedScales(cats, []repository.ScaleListItem{
|
|
{Slug: "mbti-lite", Title: "MBTI测试", Description: "from-db"},
|
|
{Slug: "eq-lite", Title: "情绪觉察探索", Description: "eq"},
|
|
})
|
|
if len(out[1].Items) != 2 {
|
|
t.Fatalf("items=%d", len(out[1].Items))
|
|
}
|
|
if out[1].Items[0].Description != "from-db" || out[1].Items[0].Badge != "热" {
|
|
t.Fatalf("unexpected %#v", out[1].Items[0])
|
|
}
|
|
}
|