notes-server/server/server_test.go

27 lines
463 B
Go

package server
import (
"local/notes-server/config"
"net/http/httptest"
"strings"
"testing"
)
func TestHead(t *testing.T) {
config.Head = "A"
w := httptest.NewRecorder()
head(w, nil)
if s := strings.TrimSpace(string(w.Body.Bytes())); s != config.Head {
t.Fatal(s)
}
}
func TestFoot(t *testing.T) {
config.Foot = "A"
w := httptest.NewRecorder()
foot(w, nil)
if s := strings.TrimSpace(string(w.Body.Bytes())); s != config.Foot {
t.Fatal(s)
}
}