health-go/test/service/service_test.go

21 lines
355 B
Go

package service
import (
"health-go/router"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPingRoute(t *testing.T) {
r := router.SetupRouter()
w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/fetchHosList", nil)
r.ServeHTTP(w, req)
assert.JSONEq(t, `{"code: 20"}`, w.Body.String())
}