github.com/soulteary/pocket-bookcase@v0.0.0-20240428065142-0b5a9a0fc98a/internal/http/routes/system_test.go (about) 1 package routes 2 3 import ( 4 "net/http" 5 "net/http/httptest" 6 "testing" 7 8 "github.com/gin-gonic/gin" 9 "github.com/sirupsen/logrus" 10 "github.com/stretchr/testify/require" 11 ) 12 13 func TestSystemRoutes(t *testing.T) { 14 logger := logrus.New() 15 16 g := gin.Default() 17 router := NewSystemRoutes(logger) 18 router.Setup(g.Group("/system")) 19 20 t.Run("/system/liveness", func(t *testing.T) { 21 w := httptest.NewRecorder() 22 req, _ := http.NewRequest("GET", "/system/liveness", nil) 23 g.ServeHTTP(w, req) 24 require.Equal(t, 200, w.Code) 25 }) 26 27 }