mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-23 02:44:42 +00:00
📗 improve ctx.Render test
This commit is contained in:
parent
8a61775f00
commit
c3b5de6b79
@ -23,6 +23,8 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/valyala/bytebufferpool"
|
||||||
|
|
||||||
utils "github.com/gofiber/utils"
|
utils "github.com/gofiber/utils"
|
||||||
fasthttp "github.com/valyala/fasthttp"
|
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{
|
err := ctx.Render("./.github/TEST_DATA/template.html", Map{
|
||||||
"Title": "Hello, World!",
|
"Title": "Hello, World!",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
buf := bytebufferpool.Get()
|
||||||
|
_, _ = buf.WriteString("overwrite")
|
||||||
|
defer bytebufferpool.Put(buf)
|
||||||
|
|
||||||
utils.AssertEqual(t, nil, err)
|
utils.AssertEqual(t, nil, err)
|
||||||
utils.AssertEqual(t, "<h1>Hello, World!</h1>", string(ctx.Fasthttp.Response.Body()))
|
utils.AssertEqual(t, "<h1>Hello, World!</h1>", string(ctx.Fasthttp.Response.Body()))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user