+9
-8
@@ -52,6 +52,7 @@ func TestModuleNavigation_按账号保存稳定列表状态且安全回退(t *te
|
||||
"data-module-root=\"/shopee\"",
|
||||
"data-module-root=\"/pdd\"",
|
||||
"data-module-root=\"/syb\"",
|
||||
"data-module-root=\"/shops\"",
|
||||
"data-module-root=\"/tasks\"",
|
||||
"data-module-root=\"/clients\"",
|
||||
"data-module-root=\"/users\"",
|
||||
@@ -64,7 +65,7 @@ func TestModuleNavigation_按账号保存稳定列表状态且安全回退(t *te
|
||||
jsSource := string(js)
|
||||
for _, want := range []string{
|
||||
"var MODULE_QUERY_KEYS = {",
|
||||
"\"/shopee\": [\"goods_id\", \"shop_name\", \"status\", \"shop\", \"image\", \"deleted\", \"page\"]",
|
||||
"\"/shopee\": [\"goods_id\", \"shop_name\", \"status\", \"shop\", \"image\", \"store\", \"deleted\", \"page\"]",
|
||||
"\"/syb\": [\"order_no\", \"shop\", \"stage\", \"page\", \"date_from\", \"date_to\"]",
|
||||
"var MODULE_STATE_PREFIX = \"cmautobuy:module-state:\"",
|
||||
"parsed.origin !== window.location.origin || parsed.pathname !== moduleRoot",
|
||||
@@ -315,8 +316,8 @@ func TestSybPage_明确展示蝦皮商品Pdd关联来源(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSybAllowedShops_只给停用项提供二次确认删除(t *testing.T) {
|
||||
templateContent, err := os.ReadFile("templates/syb/shops.html")
|
||||
func TestShops_独立模块区分全局和SYB状态且保护删除(t *testing.T) {
|
||||
templateContent, err := os.ReadFile("templates/shop/list.html")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -326,16 +327,16 @@ func TestSybAllowedShops_只给停用项提供二次确认删除(t *testing.T) {
|
||||
}
|
||||
page := string(templateContent)
|
||||
for _, want := range []string{
|
||||
`{{if not .Enabled}}`, `action="/syb/shops/delete"`,
|
||||
`data-confirm-submit="确定永久删除已停用店铺“{{.ShopName}}”吗?`,
|
||||
`{{if not .Enabled}}`, `action="/shops/delete"`, `action="/shops/syb-status"`,
|
||||
`data-confirm-submit="确定删除停用店铺“{{.DisplayName}}”吗?`,
|
||||
`class="danger">删除`,
|
||||
} {
|
||||
if !strings.Contains(page, want) {
|
||||
t.Errorf("同步店铺管理页缺少删除保护 %q", want)
|
||||
t.Errorf("店铺管理页缺少状态或删除保护 %q", want)
|
||||
}
|
||||
}
|
||||
if !strings.Contains(string(routes), `sybShops.POST("/delete", h.SybAllowedShopDelete)`) {
|
||||
t.Error("同步店铺删除没有挂到管理员路由组")
|
||||
if !strings.Contains(string(routes), `shops.POST("/delete", h.ShopDelete)`) {
|
||||
t.Error("店铺删除没有挂到管理员路由组")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user