Skip to content

Commit

Permalink
Added a small unit test for the new error meta stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsky committed Sep 18, 2020
1 parent 7c561c0 commit e513c7a
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions asc/asc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,35 @@ func TestCheckBadResponse(t *testing.T) {
Method: "GET",
URL: &url.URL{},
},
Body: ioutil.NopCloser(strings.NewReader(`{"errors":[{"code":"","status":"","title":"","detail":""}]}`)),
Body: ioutil.NopCloser(strings.NewReader(`{
"errors": [
{
"code": "",
"status": "",
"title": "",
"detail": "",
"meta": {
"associatedErrors": {
"/v1/route/": [
{
"code": "",
"status": "",
"title": "",
"detail": ""
}
]
}
}
}
]
}`)),
},
}
err := checkResponse(resp)
assert.Error(t, err)
assert.IsType(t, new(ErrorResponse), err)
assert.Equal(t, resp.Response, err.(*ErrorResponse).Response)
assert.NotZero(t, len(err.Error()))
assert.NotEmpty(t, err.Error())
}

func TestAppendingQueryOptions(t *testing.T) {
Expand Down

0 comments on commit e513c7a

Please sign in to comment.