package server import ( "local/notes-server/config" "net/http/httptest" "regexp" "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) } } func TestBlock(t *testing.T) { w := httptest.NewRecorder() block(w, "hi") s := strings.ReplaceAll(strings.TrimSpace(string(w.Body.Bytes())), "\n", ".") if ok, err := regexp.MatchString("