22 lines
402 B
Go
22 lines
402 B
Go
package apis
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/stretchr/testify/assert"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestPingRoute(t *testing.T) {
|
|
r := gin.Default()
|
|
SetupRouter(r, nil)
|
|
|
|
w := httptest.NewRecorder()
|
|
req, _ := http.NewRequest("GET", "/ping", nil)
|
|
r.ServeHTTP(w, req)
|
|
|
|
assert.Equal(t, 200, w.Code)
|
|
assert.JSONEq(t, `{"message": "pong"}`, w.Body.String())
|
|
}
|