MCPcopy Create free account
hub / github.com/algolia/cli / TestGetCrawlerUser_InvalidJSON

Function TestGetCrawlerUser_InvalidJSON

api/dashboard/client_test.go:620–633  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

618}
619
620func TestGetCrawlerUser_InvalidJSON(t *testing.T) {
621 mux := http.NewServeMux()
622 mux.HandleFunc("/1/crawler/user", func(w http.ResponseWriter, r *http.Request) {
623 _, err := w.Write([]byte(`{"data":`))
624 require.NoError(t, err)
625 })
626
627 ts, client := newTestClient(mux)
628 defer ts.Close()
629
630 _, err := client.GetCrawlerUser("test-token")
631 require.Error(t, err)
632 assert.Contains(t, err.Error(), "failed to parse crawler response")
633}
634
635func TestGetCrawlerUser_HTTPErrorInvalidJSON(t *testing.T) {
636 mux := http.NewServeMux()

Callers

nothing calls this directly

Calls 4

newTestClientFunction · 0.85
GetCrawlerUserMethod · 0.80
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected