Skip to content

Commit

Permalink
Renamed panic render to render in context test
Browse files Browse the repository at this point in the history
  • Loading branch information
eeonevision committed Jan 10, 2023
1 parent 9a45526 commit f32da2d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions context_test.go
Expand Up @@ -32,7 +32,7 @@ import (

var _ context.Context = (*Context)(nil)

var errTestPanicRender = errors.New("TestPanicRender")
var errTestRender = errors.New("TestRender")

// Unit tests TODO
// func (c *Context) File(filepath string) {
Expand Down Expand Up @@ -645,21 +645,21 @@ func TestContextBodyAllowedForStatus(t *testing.T) {
assert.True(t, true, bodyAllowedForStatus(http.StatusInternalServerError))
}

type TestPanicRender struct{}
type TestRender struct{}

func (*TestPanicRender) Render(http.ResponseWriter) error {
return errTestPanicRender
func (*TestRender) Render(http.ResponseWriter) error {
return errTestRender
}

func (*TestPanicRender) WriteContentType(http.ResponseWriter) {}
func (*TestRender) WriteContentType(http.ResponseWriter) {}

func TestContextRenderIfErr(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)

c.Render(http.StatusOK, &TestPanicRender{})
c.Render(http.StatusOK, &TestRender{})

assert.Equal(t, errorMsgs{&Error{Err: errTestPanicRender, Type: 1}}, c.Errors)
assert.Equal(t, errorMsgs{&Error{Err: errTestRender, Type: 1}}, c.Errors)
}

// Tests that the response is serialized as JSON
Expand Down

0 comments on commit f32da2d

Please sign in to comment.