Files
core/http/handler/ping_test.go
Jan Stabenow 9c0b535199 Add v16.7.2
2022-05-13 19:26:45 +02:00

29 lines
502 B
Go

package handler
import (
"net/http"
"testing"
"github.com/datarhei/core/http/mock"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/require"
)
func getDummyPingRouter() *echo.Echo {
router := mock.DummyEcho()
handler := NewPing()
router.Add("GET", "/", handler.Ping)
return router
}
func TestPing(t *testing.T) {
router := getDummyPingRouter()
response := mock.Request(t, http.StatusOK, router, "GET", "/", nil)
require.Equal(t, "pong", string(response.Data.([]byte)))
}