mirror of https://github.com/gin-gonic/gin.git
21 lines
348 B
Go
21 lines
348 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPingRoute(t *testing.T) {
|
|
router := setupRouter()
|
|
|
|
w := httptest.NewRecorder()
|
|
req, _ := http.NewRequest("GET", "/ping", nil)
|
|
router.ServeHTTP(w, req)
|
|
|
|
assert.Equal(t, 200, w.Code)
|
|
assert.Equal(t, "pong", w.Body.String())
|
|
}
|