Skip to content

Commit

Permalink
added empty body test
Browse files Browse the repository at this point in the history
  • Loading branch information
tamccall authored and nukosuke committed Mar 13, 2019
1 parent 8686d20 commit afa0cfa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions zendesk/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,24 @@ func TestError_Error(t *testing.T) {
resp: resp,
}

if err.Error() != fmt.Sprintf("%d: %s", status, body) {
t.Fatal("Error did not have expected value")
expected := fmt.Sprintf("%d: %s", status, body)
if v := err.Error(); v != expected {
t.Fatalf("Error %s did not have expected value %s", v, expected)
}
}

func TestError_ErrorEmptyBody(t *testing.T) {
status := http.StatusOK
resp := &http.Response{
StatusCode: status,
}
err := Error{
resp: resp,
}

expected := fmt.Sprintf("%d: %s", status, http.StatusText(status))
if v := err.Error(); v != expected {
t.Fatalf("Error %s did not have expected value %s", v, expected)
}
}

Expand Down

0 comments on commit afa0cfa

Please sign in to comment.