package slatematch import ( "net/http" "strings" "testing" "github.com/go-chi/chi/v5" "github.com/missionworkforce/missionmatch/internal/modules/matching" ) // TestNamespaceExposesSlateRoutes proves the slateMATCH namespace mounts the slate endpoints and the // shared pickers over the shared core, and NOT the screening endpoints (POST /screen, mission-check) // which belong to screenMATCH. It walks the registered routes, so it needs no database or session. func TestNamespaceExposesSlateRoutes(t *testing.T) { h := NewHandler(matching.NewHandler(matching.NewService(nil, nil, nil))) r := chi.NewRouter() r.Route("/slatematch", h.Routes) routes := map[string]bool{} if err := chi.Walk(r, func(method, route string, _ http.Handler, _ ...func(http.Handler) http.Handler) error { routes[method+" "+route] = true return nil }); err != nil { t.Fatalf("walk: %v", err) } want := []string{ "POST /slatematch/slates/generate", "PATCH /slatematch/slates/{slateID}/members/{candidateID}/decision", "GET /slatematch/slates/{slateID}/members/{candidateID}/trace", "GET /slatematch/requirements/{requirementID}/slates", "GET /slatematch/slates/{slateID}", "GET /slatematch/slates/{slateID}/proposal-readiness", "GET /slatematch/slates/{slateID}/export", "GET /slatematch/requirements", "GET /slatematch/candidates", } for _, w := range want { if !routes[w] { t.Errorf("slateMATCH namespace missing route %q", w) } } // The screening surfaces must NOT leak into slateMATCH; they are screenMATCH's. for r := range routes { if strings.Contains(r, "/screen") || strings.Contains(r, "/mission-check") { t.Errorf("slateMATCH namespace must not expose a screening route, found %q", r) } } }