health-go/test/services/sevices_test.go

21 lines
368 B
Go
Raw Normal View History

2024-11-03 01:32:51 +08:00
package services
import (
"health-go/routers"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPingRoute(t *testing.T) {
router := routers.SetupRouter()
w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/fetchHosList", nil)
router.ServeHTTP(w, req)
assert.JSONEq(t, `{"code: 20"}`, w.Body.String())
}