almost all ready
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user