Test: Ping route

This commit is contained in:
HFO4 2019-11-11 19:20:33 +08:00
parent 6f96018223
commit 1db0c6116e

20
routers/router_test.go Normal file
View file

@ -0,0 +1,20 @@
package routers
import (
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"testing"
)
func TestPing(t *testing.T) {
asserts := assert.New(t)
router := InitRouter()
w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/Api/V3/Ping", nil)
router.ServeHTTP(w, req)
assert.Equal(t, 200, w.Code)
asserts.Contains(w.Body.String(), "Pong")
}