feat: 展示顺运宝观测规格 (#140)
This commit is contained in:
@@ -121,6 +121,25 @@ func TestUpsertSybOrder_已有的ShopeeSKUID同步后仍在(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpsertSybOrder_只更新Syb骨架标题(t *testing.T) {
|
||||
db := newSybTestDB(t)
|
||||
now := model.NowISO()
|
||||
if _, err := db.Exec(`INSERT INTO shopee_products(goods_id,title,source,created_at,updated_at) VALUES('SYB-P','旧骨架','syb',?,?),('API-P','正式标题','api',?,?)`, now, now, now, now); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, o := range []model.SybOrder{{SybID: "S1", OrderNo: "O1", Title: "新骨架", ProductSpec: "黑色,M", ShopeeGoodsID: "SYB-P", Quantity: 1, PriceTwdCent: 100, SybData: "{}"}, {SybID: "S2", OrderNo: "O2", Title: "顺运宝标题", ProductSpec: "白色,L", ShopeeGoodsID: "API-P", Quantity: 1, PriceTwdCent: 200, SybData: "{}"}} {
|
||||
if _, err := UpsertSybOrder(db, o); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
var sybTitle, apiTitle string
|
||||
_ = db.QueryRow(`SELECT title FROM shopee_products WHERE goods_id='SYB-P'`).Scan(&sybTitle)
|
||||
_ = db.QueryRow(`SELECT title FROM shopee_products WHERE goods_id='API-P'`).Scan(&apiTitle)
|
||||
if sybTitle != "新骨架" || apiTitle != "正式标题" {
|
||||
t.Fatalf("来源保护失败:syb=%q api=%q", sybTitle, apiTitle)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpsertSybOrder_ShopeeGoodsID会被同步更新(t *testing.T) {
|
||||
db := newSybTestDB(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user