]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test(parser): add more tests
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 18 Dec 2019 09:09:53 +0000 (10:09 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 18 Dec 2019 09:26:15 +0000 (10:26 +0100)
__tests__/matcher/path-ranking.spec.ts

index d1beab9d996280f1e55cbd245dc049dcf795ca33..b8eddcdafee0423a17381b82e487bd6a7f1c394e 100644 (file)
@@ -123,17 +123,16 @@ describe('Path ranking', () => {
       '/a/:b/c',
       '/a/:b',
       '/a',
+      '/a-:b-:c',
+      '/a-:b',
+      '/a-:w(.*)',
+      '/:a-:b-:c',
+      '/:a-:b',
+      '/:a-:b(.*)',
+      '/:a/-:b',
       '/:a/:b',
       '/:w',
       '/:w+',
-      // '/:a/-:b',
-      // '/:a/:b',
-      // '/a-:b',
-      // '/a-:w(.*)',
-      // '/:a-b',
-      // '/:a-:b-:c',
-      // '/:a-:b',
-      // '/:a-:b(.*)',
     ])
   })
 
@@ -168,7 +167,8 @@ describe('Path ranking', () => {
     possibleOptions.forEach(options => {
       checkPathOrder(['/:w', ['/:w?', options]])
       checkPathOrder(['/:w?', ['/:w+', options]])
-      checkPathOrder(['/:w?', ['/:w*', options]])
+      checkPathOrder(['/:w+', ['/:w*', options]])
+      checkPathOrder(['/:w+', ['/:w(.*)', options]])
     })
   })
 
@@ -250,4 +250,12 @@ describe('Path ranking', () => {
       '/a/_:b(\\d)*-other',
     ])
   })
+
+  it('ending slashes less than params', () => {
+    checkPathOrder([
+      ['/a/b', { strict: false }],
+      ['/a/:b', { strict: true }],
+      ['/a/:b/', { strict: true }],
+    ])
+  })
 })