main
1package app
2
3import (
4 "net/http"
5 "net/http/httptest"
6 "testing"
7
8 "github.com/stretchr/testify/assert"
9 "gitlab.com/mokhax/sparkled/pkg/test"
10)
11
12func TestApp(t *testing.T) {
13 t.Run("New", func(t *testing.T) {
14 server := New()
15
16 t.Run("GET /index.html", func(t *testing.T) {
17 t.Skip()
18 response := httptest.NewRecorder()
19
20 server.ServeHTTP(response, test.Request("GET", "/"))
21 assert.Equal(t, http.StatusOK, response.Code)
22 assert.Contains(t, response.Body.String(), "SparkleLab")
23 })
24
25 t.Run("GET /health", func(t *testing.T) {
26 response := httptest.NewRecorder()
27
28 server.ServeHTTP(response, test.Request("GET", "/health"))
29 assert.Equal(t, http.StatusOK, response.Code)
30 })
31 })
32}