Skip to content

Commit

Permalink
feat: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Nov 3, 2023
1 parent 260f801 commit b74fa1c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions context_response_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fiber

import (
"fmt"
"io"
"net/http"
"strings"
Expand Down Expand Up @@ -276,6 +277,27 @@ func TestResponse(t *testing.T) {
},
expectCode: http.StatusMovedPermanently,
},
{
name: "Writer",
method: "GET",
url: "/writer",
setup: func(method, url string) error {
fiber.Get("/writer", func(ctx contractshttp.Context) contractshttp.Response {
_, err = fmt.Fprintf(ctx.Response().Writer(), "Goravel")
return nil
})

var err error
req, err = http.NewRequest(method, url, nil)
if err != nil {
return err
}

return nil
},
expectCode: http.StatusOK,
expectBody: "Goravel",
},
}

for _, test := range tests {
Expand Down

0 comments on commit b74fa1c

Please sign in to comment.