fix: implement resource reconciliation and update handling in media supply favorites
This commit is contained in:
@@ -616,6 +616,38 @@ func TestDecodeMeijiequanMediaListAcceptsStringNumbers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMeijiequanListMediaKeepsRawItemCountForPaging(t *testing.T) {
|
||||
client, cleanup := testMeijiequanClientWithUploadServer(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/advSupply/media/getMediaInfo" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`{
|
||||
"status": "1",
|
||||
"page": "1",
|
||||
"all_page": "0",
|
||||
"all_num": "0",
|
||||
"data": [
|
||||
{"id":"1","name":"有效媒体","sale_price":"12.5"},
|
||||
{"id":"2","sale_price":"18.0"}
|
||||
]
|
||||
}`))
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
page, err := client.ListMedia(context.Background(), 1, 1, 2)
|
||||
if err != nil {
|
||||
t.Fatalf("list media: %v", err)
|
||||
}
|
||||
if page.RawItemCount != 2 {
|
||||
t.Fatalf("expected raw count to include invalid upstream rows, got %d", page.RawItemCount)
|
||||
}
|
||||
if len(page.Items) != 1 {
|
||||
t.Fatalf("expected only valid rows to be upserted, got %d", len(page.Items))
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeMeijiequanSearchOptions(t *testing.T) {
|
||||
groups, err := decodeMeijiequanSearchOptions([]byte(`{
|
||||
"pindaoleixing": {"name": "频道类型", "list": ["IT科技", "财经金融"]},
|
||||
|
||||
Reference in New Issue
Block a user