feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package home
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeToolOK(t *testing.T) {
|
||||
b := "热"
|
||||
tone := "hot"
|
||||
got, err := normalizeTool(ReplaceInput{
|
||||
RowIndex: 1, SortOrder: 1, Path: "/portrait", Icon: "portrait", Label: "愈心解码",
|
||||
Badge: &b, BadgeTone: &tone, Enabled: true,
|
||||
})
|
||||
if err != nil || got.Label != "愈心解码" {
|
||||
t.Fatalf("got=%+v err=%v", got, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeToolRejects(t *testing.T) {
|
||||
cases := []ReplaceInput{
|
||||
{RowIndex: 3, Path: "/a", Icon: "ask", Label: "x"},
|
||||
{RowIndex: 1, Path: "https://evil.com", Icon: "ask", Label: "x"},
|
||||
{RowIndex: 1, Path: "/../etc", Icon: "ask", Label: "x"},
|
||||
{RowIndex: 1, Path: "/ask", Icon: "nope", Label: "x"},
|
||||
{RowIndex: 1, Path: "/ask", Icon: "ask", Label: ""},
|
||||
}
|
||||
for i, c := range cases {
|
||||
if _, err := normalizeTool(c); err != ErrInvalidTools {
|
||||
t.Fatalf("case %d want ErrInvalidTools got %v", i, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user