-
Notifications
You must be signed in to change notification settings - Fork 1
/
catch-all.spec.ts
34 lines (32 loc) · 959 Bytes
/
catch-all.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { it, expect } from 'vitest';
import { findManualMigrations } from 'vue-metamorph';
import { catchAllPlugin } from './catch-all';
it('should report catch-all star routes', () => {
const input = `
const routes = [
{ name: 'foo', path: '/foo' },
{ name: 'not-found', path: '*' }
]
`;
expect(findManualMigrations(input, 'file.js', [catchAllPlugin])).toMatchInlineSnapshot(`
[
{
"columnEnd": 32,
"columnStart": 24,
"file": "file.js",
"lineEnd": 4,
"lineStart": 4,
"message": "Catch-all routes must now be defined as '/:pathMatch(.*)*'
See: https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes",
"pluginName": "vue-router-catch-all",
"snippet": "1 |
2 | const routes = [
3 | { name: 'foo', path: '/foo' },
4 | { name: 'not-found', path: '*' }
| ^^^^^^^^^
5 | ]
6 | ",
},
]
`);
});