(t *testing.T)
| 261 | } |
| 262 | |
| 263 | func TestContextJSONPretty(t *testing.T) { |
| 264 | e := New() |
| 265 | rec := httptest.NewRecorder() |
| 266 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 267 | c := e.NewContext(req, rec) |
| 268 | |
| 269 | err := c.JSONPretty(http.StatusOK, user{ID: 1, Name: "Jon Snow"}, " ") |
| 270 | if assert.NoError(t, err) { |
| 271 | assert.Equal(t, http.StatusOK, rec.Code) |
| 272 | assert.Equal(t, MIMEApplicationJSON, rec.Header().Get(HeaderContentType)) |
| 273 | assert.Equal(t, userJSONPretty+"\n", rec.Body.String()) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | func TestContextJSONWithEmptyIntent(t *testing.T) { |
| 278 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…