]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: fix parser usage
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 11 Aug 2025 08:04:37 +0000 (10:04 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 11 Aug 2025 08:04:37 +0000 (10:04 +0200)
packages/router/src/experimental/route-resolver/matchers/matcher-pattern.test-d.ts

index ab4a296a6d94f1ae6bce58a37216f369b000f45b..d436153fb186895d37b5f900ab4b2995c6ef44b2 100644 (file)
@@ -1,7 +1,7 @@
 import { describe, expectTypeOf, it } from 'vitest'
 import {
   MatcherPatternPathCustomParams,
-  PARAM_INTEGER,
+  PARAM_INTEGER_SINGLE,
   PATH_PARAM_DEFAULT_PARSER,
   PATH_PARAM_SINGLE_DEFAULT,
 } from './matcher-pattern'
@@ -10,7 +10,7 @@ describe('MatcherPatternPathCustomParams', () => {
   it('can be generic', () => {
     const matcher = new MatcherPatternPathCustomParams(
       /^\/users\/([^/]+)$/i,
-      { userId: { parser: PATH_PARAM_DEFAULT_PARSER } },
+      { userId: { ...PATH_PARAM_DEFAULT_PARSER } },
       ['users', 0]
     )
 
@@ -35,7 +35,7 @@ describe('MatcherPatternPathCustomParams', () => {
   it('can be a simple param', () => {
     const matcher = new MatcherPatternPathCustomParams(
       /^\/users\/([^/]+)\/([^/]+)$/i,
-      { userId: { parser: PATH_PARAM_SINGLE_DEFAULT, repeat: true } },
+      { userId: { ...PATH_PARAM_SINGLE_DEFAULT, repeat: true } },
       ['users', 0]
     )
     expectTypeOf(matcher.match('/users/123/456')).toEqualTypeOf<{
@@ -55,7 +55,7 @@ describe('MatcherPatternPathCustomParams', () => {
       /^\/profiles\/([^/]+)$/i,
       {
         userId: {
-          parser: PARAM_INTEGER,
+          ...PARAM_INTEGER_SINGLE,
           // parser: PATH_PARAM_DEFAULT_PARSER,
         },
       },