]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: trailing slash
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 24 Aug 2025 19:39:38 +0000 (21:39 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sun, 24 Aug 2025 19:39:38 +0000 (21:39 +0200)
packages/router/src/experimental/route-resolver/matchers/matcher-pattern.spec.ts

index ac28af0a8689affa8a1d03e42da03dd61e4435cc..9b660d1f56796d5a87680a6071c1a4c0723ede88 100644 (file)
@@ -29,6 +29,20 @@ describe('MatcherPatternPathStatic', () => {
       expect(pattern.match('/TEAM')).toEqual({})
       expect(pattern.match('/tEAm')).toEqual({})
     })
+
+    it('keeps a trailing slash', () => {
+      const pattern = new MatcherPatternPathStatic('/team/')
+      expect(pattern.match('/team/')).toEqual({})
+    })
+
+    it('strict on trailing slash', () => {
+      expect(() =>
+        new MatcherPatternPathStatic('/team').match('/team/')
+      ).toThrow()
+      expect(() =>
+        new MatcherPatternPathStatic('/team/').match('/team')
+      ).toThrow()
+    })
   })
 
   describe('build()', () => {