package server import ( "bytes" "context" "encoding/json" "github.com/jackc/pgx/v5/pgxpool" "net/http/httptest" "os" "perler-beads-server/internal/domain" "strings" "testing" ) func TestAnonymousPermissions(t *testing.T) { r := (&Server{}).Router() for _, path := range []string{"/api/me", "/api/my/patterns", "/api/favorites", "/api/tables", "/api/service-requests", "/api/admin/patterns"} { w := httptest.NewRecorder() r.ServeHTTP(w, httptest.NewRequest("GET", path, nil)) var v struct{ Code int } if json.Unmarshal(w.Body.Bytes(), &v) != nil || w.Code != 200 || v.Code != 403 { t.Fatalf("%s: %s", path, w.Body) } } } func TestPrintMillimetersEscapes(t *testing.T) { code := "R" p := domain.Pattern{Title: "