summaryrefslogtreecommitdiff
path: root/pkg/web/server_test.go
blob: fd3c0ade1398b9060a1769a0af2b0eae1d747b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package web

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
	"gitlab.com/mokhax/sparkled/pkg/db"
	"gitlab.com/mokhax/sparkled/pkg/test"
)

func TestServer(t *testing.T) {
	server := New(db.NewRepository())

	t.Run("GET /index.html", func(t *testing.T) {
		t.Skip()
		response := httptest.NewRecorder()

		server.ServeHTTP(response, test.Request("GET", "/"))
		assert.Equal(t, http.StatusOK, response.Code)
		assert.Contains(t, response.Body.String(), "SparkleLab")
	})

	t.Run("GET /health", func(t *testing.T) {
		response := httptest.NewRecorder()

		server.ServeHTTP(response, test.Request("GET", "/health"))
		assert.Equal(t, http.StatusOK, response.Code)
	})
}