You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
it "Should match plain route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/plain/route' |
|
all '/plain/route' |
|
}) |
|
|
|
it "Should not match incorrect plain route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/plain/WRONG' |
|
! all '/plain/route' |
|
}) |
|
|
|
it "Should extract parameter" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/cats/calico/pet' |
|
all '/cats/:cat/pet' && hasParam 'cat' && [ "$(param 'cat')" == 'calico' ] |
|
}) |
|
|
|
it "Should match wildcard route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/cats/calico/pet' |
|
all '/cats/*/pet' |
|
}) |
|
|
|
it "Should not match incorrect wildcard route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/cats/calico/' |
|
! all '/cats/*/pet' |
|
}) |
|
|
|
it "Should match multi-wildcard route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/cats/calico/pet/donkey' |
|
all '/cats/**' |
|
}) |
|
|
|
it "Should not match incorrect multi-wildcard route" $({ |
|
_exprashResetRouteGlobals |
|
PATH_INFO='/INCORRECT/calico/pet/donkey' |
|
! all '/cats/**' |
|
}) |
|
|
|
it "Should match get route" $({ |
|
_exprashResetRouteGlobals |
|
REQUEST_METHOD='GET' |
|
PATH_INFO='/simple/route' |
|
get '/simple/route' |
|
}) |
|
|
|
it "Should not match get route with incorrect method" $({ |
|
_exprashResetRouteGlobals |
|
REQUEST_METHOD='POST' |
|
PATH_INFO='/simple/route' |
|
! get '/simple/route' |
|
})
|
|
|