Files
ps_shop/internal/prestashop/routes/service_test.go
T
2026-05-14 01:48:15 +02:00

26 lines
789 B
Go

package routes
import "testing"
func TestCategoryRouteDoesNotOwnImagePath(t *testing.T) {
route, err := CompileCategoryRoute("/{id}-{rewrite}")
if err != nil {
t.Fatalf("compile category route: %v", err)
}
if match, ok := route.MatchInfo("/img/p/1/1/9/6/1/2/119612-large_default.webp"); ok || match != nil {
t.Fatalf("expected image path to bypass category route, got ok=%v match=%+v", ok, match)
}
}
func TestProductRouteDoesNotOwnImagePath(t *testing.T) {
route, err := CompileProductRoute("/{id}-{rewrite}")
if err != nil {
t.Fatalf("compile product route: %v", err)
}
if match, ok := route.MatchInfo("/img/p/1/1/9/6/1/2/119612-large_default.webp"); ok || match != nil {
t.Fatalf("expected image path to bypass product route, got ok=%v match=%+v", ok, match)
}
}