feat: 增加蝦皮店铺名称搜索 (#182)

This commit is contained in:
chengma
2026-08-12 15:09:35 +08:00
parent aa6d812ac6
commit 889f568554
11 changed files with 94 additions and 40 deletions
+8 -7
View File
@@ -43,11 +43,11 @@ func assertRedirectQuery(t *testing.T, recorder *httptest.ResponseRecorder, want
func Test列表写操作跳转保留筛选和页码(t *testing.T) {
t.Run("蝦皮", func(t *testing.T) {
context, recorder := listPostContext(t, "/shopee/save", url.Values{
"list_goods_id": {"1001"}, "status": {"no_link"}, "shop": {"has"}, "image": {"missing"}, "page": {"2"},
"list_goods_id": {"1001"}, "list_shop_name": {"店铺 A"}, "status": {"no_link"}, "shop": {"has"}, "image": {"missing"}, "page": {"2"},
})
(&Handler{}).shopeeRedirect(context, "完成")
assertRedirectQuery(t, recorder, "/shopee", map[string]string{
"goods_id": "1001", "status": "no_link", "shop": "has", "image": "missing", "page": "2", "msg": "完成",
"goods_id": "1001", "shop_name": "店铺 A", "status": "no_link", "shop": "has", "image": "missing", "page": "2", "msg": "完成",
})
})
t.Run("顺运宝", func(t *testing.T) {
@@ -100,17 +100,18 @@ func Test列表写操作跳转保留筛选和页码(t *testing.T) {
func Test蝦皮分页详情和状态条保留资料筛选(t *testing.T) {
values := url.Values{
"goods_id": {"1001"},
"status": {"has_link"},
"shop": {"has"},
"image": {"missing"},
"goods_id": {"1001"},
"shop_name": {"店铺 A"},
"status": {"has_link"},
"shop": {"has"},
"image": {"missing"},
}
detail, err := url.Parse("/shopee/detail?" + detailValuesForShopee(values, 3))
if err != nil {
t.Fatal(err)
}
for key, want := range map[string]string{
"goods_id": "1001", "status": "has_link", "shop": "has", "image": "missing", "page": "3",
"goods_id": "1001", "shop_name": "店铺 A", "status": "has_link", "shop": "has", "image": "missing", "page": "3",
} {
if got := detail.Query().Get(key); got != want {
t.Errorf("详情参数 %s=%q,期望 %q", key, got, want)