1
0
mirror of https://github.com/labstack/echo.git synced 2026-03-12 15:46:17 +02:00
Files
echo/echotest/reader_external_test.go
toimtoimtoim f071367e3c V5 changes
2026-01-18 18:14:41 +02:00

26 lines
579 B
Go

package echotest_test
import (
"strings"
"testing"
"github.com/labstack/echo/v5/echotest"
"github.com/stretchr/testify/assert"
)
const testJSONContent = `{
"field": "value"
}`
func TestLoadBytesOK(t *testing.T) {
data := echotest.LoadBytes(t, "testdata/test.json")
assert.Equal(t, []byte(testJSONContent+"\n"), data)
}
func TestLoadBytes_custom(t *testing.T) {
data := echotest.LoadBytes(t, "testdata/test.json", func(bytes []byte) []byte {
return []byte(strings.ToUpper(string(bytes)))
})
assert.Equal(t, []byte(strings.ToUpper(testJSONContent)+"\n"), data)
}