1
1
test ( "run() boolean for match found" , function ( ) {
2
2
expect ( 1 ) ;
3
3
var router = new PathParser ;
4
- router . add ( 'items' , function ( ) {
5
- } ) ;
4
+ router . add ( 'items' , function ( ) { } ) ;
6
5
router . add ( 'itemsnomatch' , function ( ) {
7
6
throw "Incorrect match" ;
8
7
} ) ;
@@ -18,31 +17,34 @@ test("run() boolean for no match found", function () {
18
17
test ( "Single-part fixed path" , function ( ) {
19
18
expect ( 1 ) ;
20
19
var router = new PathParser ;
21
- router . add ( 'items' , function ( ) {
22
- ok ( true ) ;
20
+ router . add ( 'items/top ' , function ( ) {
21
+ throw "Incorrect match" ;
23
22
} ) ;
24
23
router . add ( 'itemsnomatch' , function ( ) {
25
24
throw "Incorrect match" ;
26
25
} ) ;
26
+ router . add ( 'item' , function ( ) {
27
+ throw "Incorrect match" ;
28
+ } ) ;
29
+ router . add ( 'items' , function ( ) {
30
+ ok ( true ) ;
31
+ } ) ;
27
32
router . run ( 'items' ) ;
28
33
} ) ;
29
34
30
35
test ( "Multi-part fixed path" , function ( ) {
31
36
expect ( 1 ) ;
32
37
var router = new PathParser ;
33
- router . add ( 'items/top' , function ( ) {
34
- throw "Incorrect match" ;
35
- } ) ;
36
38
router . add ( 'items' , function ( ) {
37
- ok ( true ) ;
39
+ throw "Incorrect match" ;
38
40
} ) ;
39
41
router . add ( 'itemsnomatch' , function ( ) {
40
42
throw "Incorrect match" ;
41
43
} ) ;
42
- router . add ( 'item ' , function ( ) {
43
- throw "Incorrect match" ;
44
+ router . add ( 'items/top ' , function ( ) {
45
+ ok ( true ) ;
44
46
} ) ;
45
- router . run ( 'items' ) ;
47
+ router . run ( 'items/top ' ) ;
46
48
} ) ;
47
49
48
50
test ( "Don't match fixed path with additional parts" , function ( ) {
0 commit comments