fix: make test JSON easier to read

This commit is contained in:
Daniel G. Taylor 2021-02-11 11:51:07 -08:00
parent a24e490b76
commit 065e5e3927
No known key found for this signature in database
GPG key ID: 8D100732CA686E06

View file

@ -71,7 +71,12 @@ func TestNestedResolver(t *testing.T) {
// Test happy case just sending ONE of the two possible fields in each struct.
w := httptest.NewRecorder()
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{"foo": {"a": [{"one": "1"}], "b": [{"two": "2"}]}}`))
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{
"foo": {
"a": [{"one": "1"}],
"b": [{"two": "2"}]
}
}`))
app.ServeHTTP(w, r)
assert.Equal(t, http.StatusNoContent, w.Result().StatusCode)
@ -92,7 +97,13 @@ func TestNestedResolverError(t *testing.T) {
// not allowed. Should get a validation error response generated by the
// `Dep1.Resolve(...)` method above.
w := httptest.NewRecorder()
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{"foo": {"a": [{"one": "1", "two": "2"}]}}`))
r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(`{
"foo": {
"a": [
{"one": "1", "two": "2"}
]
}
}`))
app.ServeHTTP(w, r)
assert.JSONEq(t, `{