test: add tests for errors
This commit is contained in:
@@ -25,9 +25,13 @@ func TestClient_do(t *testing.T) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = c.do(req, url, nil)
|
||||
err = c.do(req, nil)
|
||||
var e *HTTPClientError
|
||||
if errors.Is(err, e) {
|
||||
t.Errorf("should be an http error, but was not: %v", err)
|
||||
}
|
||||
err = c.do(nil, nil)
|
||||
if err == nil {
|
||||
t.Errorf("there should be an error, but was nil")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user