MCPcopy Create free account
hub / github.com/convox/rack / AssertJSON

Method AssertJSON

pkg/test/handler_func.go:65–72  ·  view source on GitHub ↗

AssertJSON assets a JSON response (ignoring whitespace differences)

(t *testing.T, body string)

Source from the content-addressed store, hash-verified

63
64// AssertJSON assets a JSON response (ignoring whitespace differences)
65func (f *HandlerFuncTest) AssertJSON(t *testing.T, body string) {
66 b1, err1 := stripJSON([]byte(body))
67 b2, err2 := stripJSON(f.Body())
68
69 if assert.NoError(t, err1) && assert.NoError(t, err2) {
70 assert.Equal(t, string(b1), string(b2))
71 }
72}
73
74// AssertSuccess asserts a successful response
75func (f *HandlerFuncTest) AssertSuccess(t *testing.T) {

Callers 1

AssertSuccessMethod · 0.95

Calls 2

BodyMethod · 0.95
stripJSONFunction · 0.85

Tested by

no test coverage detected