Skip to content

Commit

Permalink
Baidu [ImageUrlBuild] test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karust committed Jul 11, 2023
1 parent 284aebb commit 4d6921d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions baidu/all_test.go
Original file line number Diff line number Diff line change
@@ -43,17 +43,17 @@ func TestSearch(t *testing.T) {
}

func TestImageUrlBuild(t *testing.T) {
query := core.Query{Text: "金毛猎犬", Limit: 10}
query := core.Query{Text: "金毛猎犬"}

res, err := BuildImageURL(query, 0)
got, err := BuildImageURL(query, 0)
if err != nil {
t.Fatal(err)
}

want := "https://image.baidu.com/search/acjson?cl=2&ie=utf-8&ipn=r&tn=resultjson_com&word=%E9%87%91%E6%AF%9B%E7%8C%8E%E7%8A%AC"
want := "https://image.baidu.com/search/acjson?cl=2&fp=result&ie=utf-8&ipn=rj&oe=utf-8&pn=0&rn=30&tn=resultjson_com&word=%E9%87%91%E6%AF%9B%E7%8C%8E%E7%8A%AC"

if want != res {
t.Fatalf("Wanted result `%s` doesn't match to resulted `%s`", want, res)
if want != got {
t.Fatalf("Want: `%s`, Got `%s`", want, got)
}
}

0 comments on commit 4d6921d

Please sign in to comment.