Merge pull request #634 from kiyonlin/add-render-tc

📗 improve ctx.Render test
pull/636/head v1.13.0
fenny 2020-07-18 03:10:54 +02:00 committed by GitHub
commit 55d0fe1944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,8 @@ import (
"text/template"
"time"
"github.com/valyala/bytebufferpool"
utils "github.com/gofiber/utils"
fasthttp "github.com/valyala/fasthttp"
)
@ -1414,6 +1416,11 @@ func Test_Ctx_Render(t *testing.T) {
err := ctx.Render("./.github/TEST_DATA/template.html", Map{
"Title": "Hello, World!",
})
buf := bytebufferpool.Get()
_, _ = buf.WriteString("overwrite")
defer bytebufferpool.Put(buf)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "<h1>Hello, World!</h1>", string(ctx.Fasthttp.Response.Body()))