]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat(warn): better wording
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 25 Aug 2022 11:49:51 +0000 (13:49 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 25 Aug 2022 11:49:51 +0000 (13:49 +0200)
#1530

packages/router/__tests__/warnings.spec.ts
packages/router/src/matcher/index.ts

index b6ac76087e184ea3e50c687172f38375b166ecb5..0d2d9927639097d8e895b3dc044904b28fcdf033 100644 (file)
@@ -68,7 +68,7 @@ describe('warnings', () => {
       routes: [{ path: '/:p/:c', alias: ['/:p/c'], component }],
     })
     expect(
-      'Alias "/:p/c" and the original record: "/:p/:c" should have the exact same param named "c"'
+      'Alias "/:p/c" and the original record: "/:p/:c" must have the exact same param named "c"'
     ).toHaveBeenWarned()
   })
 
@@ -90,7 +90,7 @@ describe('warnings', () => {
       ],
     })
     expect(
-      `Absolute path "/:a/b" should have the exact same param named "b" as its parent "/:a/:b".`
+      `Absolute path "/:a/b" must have the exact same param named "b" as its parent "/:a/:b".`
     ).toHaveBeenWarned()
   })
 
@@ -100,7 +100,7 @@ describe('warnings', () => {
       routes: [{ path: '/:p/:c', alias: ['/:p/:c+'], component }],
     })
     expect(
-      'Alias "/:p/:c+" and the original record: "/:p/:c" should have the exact same param named "c"'
+      'Alias "/:p/:c+" and the original record: "/:p/:c" must have the exact same param named "c"'
     ).toHaveBeenWarned()
   })
 
@@ -110,7 +110,7 @@ describe('warnings', () => {
       routes: [{ path: '/:p/c', alias: ['/:p/:c'], component }],
     })
     expect(
-      'Alias "/:p/:c" and the original record: "/:p/c" should have the exact same param named "c"'
+      'Alias "/:p/:c" and the original record: "/:p/c" must have the exact same param named "c"'
     ).toHaveBeenWarned()
   })
 
@@ -139,7 +139,7 @@ describe('warnings', () => {
 
   it('warns if a non valid function is passed as a component', async () => {
     const Functional: FunctionalComponent = () => h('div', 'functional')
-    // Functional should have a displayName to avoid the warning
+    // Functional must have a displayName to avoid the warning
 
     const router = createRouter({
       history: createMemoryHistory(),
index bd922eb54b41485df1dde2599f03f7d974c5d94f..f2bf941b5ebdb4a347b0adc8ed279f5820770284 100644 (file)
@@ -449,13 +449,13 @@ function checkSameParams(a: RouteRecordMatcher, b: RouteRecordMatcher) {
   for (const key of a.keys) {
     if (!key.optional && !b.keys.find(isSameParam.bind(null, key)))
       return warn(
-        `Alias "${b.record.path}" and the original record: "${a.record.path}" should have the exact same param named "${key.name}"`
+        `Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`
       )
   }
   for (const key of b.keys) {
     if (!key.optional && !a.keys.find(isSameParam.bind(null, key)))
       return warn(
-        `Alias "${b.record.path}" and the original record: "${a.record.path}" should have the exact same param named "${key.name}"`
+        `Alias "${b.record.path}" and the original record: "${a.record.path}" must have the exact same param named "${key.name}"`
       )
   }
 }
@@ -491,7 +491,7 @@ function checkMissingParamsInAbsolutePath(
   for (const key of parent.keys) {
     if (!record.keys.find(isSameParam.bind(null, key)))
       return warn(
-        `Absolute path "${record.record.path}" should have the exact same param named "${key.name}" as its parent "${parent.record.path}".`
+        `Absolute path "${record.record.path}" must have the exact same param named "${key.name}" as its parent "${parent.record.path}".`
       )
   }
 }