summaryrefslogtreecommitdiff
path: root/app/app_test.go
blob: f1cc28cc19617c197d05721d848a5a0601185c30 (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
package app

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

	"github.com/stretchr/testify/assert"
	"github.com/xlgmokha/x/pkg/test"
	"github.com/xlgmokha/x/pkg/x"
)

func TestApp(t *testing.T) {
	t.Run("New", func(t *testing.T) {
		wd := x.Must(os.Getwd())
		server := New(wd + "/..")

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

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