refactor: 切换蝦皮数据到目录接口 (#135)
This commit is contained in:
@@ -120,6 +120,37 @@ func TestTaskPage_创建人筛选列表列和详情字段齐全(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestShopeePage_移除Excel入口且保留目录记录入口(t *testing.T) {
|
||||
content, err := os.ReadFile("templates/shopee/list.html")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
page := string(content)
|
||||
for _, removed := range []string{`action="/shopee/import"`, `type="file"`, "导入 Excel"} {
|
||||
if strings.Contains(page, removed) {
|
||||
t.Errorf("蝦皮页面仍包含已移除入口 %q", removed)
|
||||
}
|
||||
}
|
||||
for _, want := range []string{`href="/integrations/catalog"`, "商品目录接口"} {
|
||||
if !strings.Contains(page, want) {
|
||||
t.Errorf("蝦皮页面缺少 %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestShopeeImportRoute_已移除(t *testing.T) {
|
||||
router, err := newRouter(nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req := httptest.NewRequest(http.MethodPost, "/shopee/import", nil)
|
||||
resp := httptest.NewRecorder()
|
||||
router.ServeHTTP(resp, req)
|
||||
if resp.Code != http.StatusNotFound {
|
||||
t.Fatalf("旧蝦皮导入路由应为 404,实际 %d", resp.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTemplatesAndRoutesCanBeBuiltWithoutDatabaseConnection(t *testing.T) {
|
||||
if _, err := newRouter(nil); err != nil {
|
||||
t.Fatalf("模板或路由组装失败: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user