clortho/apis/apis_test.go
Maxime Duchene-Savard 5a23f5ecfe first commit
2025-03-30 22:44:56 -04:00

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())
}