Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmanno committed Mar 30, 2022
1 parent 30ed65f commit f8d8808
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/http/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestSendError(t *testing.T) {
err = errors.New(nil).WithCode(errors.NotFoundCode).WithMessage("object not found")
SendError(rw, err)
assert.Equal(t, http.StatusNotFound, rw.Code)
assert.Equal(t, `{"errors":[{"code":"NOT_FOUND","message":"object not found"}]}`+"\n", rw.Body.String())
assert.Equal(t, `{"errors":[{"code":"MANIFEST_UNKNOWN","message":"object not found"}]}`+"\n", rw.Body.String())
}

func TestAPIError(t *testing.T) {
Expand All @@ -71,7 +71,7 @@ func TestAPIError(t *testing.T) {
err = errors.New(nil).WithCode(errors.NotFoundCode).WithMessage("resource not found")
statusCode, payload, stacktrace = apiError(err)
assert.Equal(t, http.StatusNotFound, statusCode)
assert.Equal(t, `{"errors":[{"code":"NOT_FOUND","message":"resource not found"}]}`, payload)
assert.Equal(t, `{"errors":[{"code":"MANIFEST_UNKNOWN","message":"resource not found"}]}`, payload)
assert.Contains(t, stacktrace, `http.TestAPIError`)

// common error, common error has no stacktrace
Expand Down

0 comments on commit f8d8808

Please sign in to comment.