|
1 | | -import { createRouterMatcher } from '../matcher' |
2 | | -import { RouteComponent, RouteRecordRaw } from '../types' |
| 1 | +import { describe, expect, it } from 'vitest' |
3 | 2 | import { defineComponent } from 'vue' |
| 3 | +import { RouteComponent, RouteRecordRaw } from '../types' |
4 | 4 | import { stringifyURL } from '../location' |
5 | | -import { describe, expect, it } from 'vitest' |
6 | 5 | import { mockWarn } from '../../__tests__/vitest-mock-warn' |
7 | 6 | import { |
8 | 7 | createCompiledMatcher, |
9 | | - MatcherLocationRaw, |
10 | | - NEW_MatcherRecordRaw, |
11 | | - NEW_LocationResolved, |
12 | | - NEW_MatcherRecord, |
| 8 | + type MatcherLocationRaw, |
| 9 | + type NEW_MatcherRecordRaw, |
| 10 | + type NEW_LocationResolved, |
| 11 | + type NEW_MatcherRecord, |
13 | 12 | } from './resolver' |
14 | | -import { PathParams, tokensToParser } from '../matcher/pathParserRanker' |
15 | | -import { tokenizePath } from '../matcher/pathTokenizer' |
16 | 13 | import { miss } from './matchers/errors' |
17 | | -import { MatcherPatternPath } from './matcher-pattern' |
18 | | -import { EXPERIMENTAL_RouteRecordRaw } from '../experimental/router' |
| 14 | +import { MatcherPatternPath, MatcherPatternPathStatic } from './matcher-pattern' |
| 15 | +import { type EXPERIMENTAL_RouteRecordRaw } from '../experimental/router' |
19 | 16 | import { stringifyQuery } from '../query' |
20 | | -import { |
| 17 | +import type { |
21 | 18 | MatcherLocationAsNamed, |
22 | 19 | MatcherLocationAsPathAbsolute, |
23 | 20 | } from './matcher-location' |
| 21 | +// TODO: should be moved to a different test file |
| 22 | +// used to check backward compatible paths |
| 23 | +import { PathParams, tokensToParser } from '../matcher/pathParserRanker' |
| 24 | +import { tokenizePath } from '../matcher/pathTokenizer' |
24 | 25 |
|
25 | 26 | // for raw route record |
26 | 27 | const component: RouteComponent = defineComponent({}) |
@@ -464,22 +465,12 @@ describe('RouterMatcher.resolve', () => { |
464 | 465 | }) |
465 | 466 |
|
466 | 467 | describe.skip('LocationAsRelative', () => { |
467 | | - it('warns if a path isn not absolute', () => { |
468 | | - const record = { |
469 | | - path: '/parent', |
470 | | - components, |
471 | | - } |
472 | | - const matcher = createRouterMatcher([record], {}) |
473 | | - matcher.resolve( |
474 | | - { path: 'two' }, |
475 | | - { |
476 | | - path: '/parent/one', |
477 | | - name: undefined, |
478 | | - params: {}, |
479 | | - matched: [] as any, |
480 | | - meta: {}, |
481 | | - } |
482 | | - ) |
| 468 | + // TODO: not sure where this warning should appear now |
| 469 | + it.todo('warns if a path isn not absolute', () => { |
| 470 | + const matcher = createCompiledMatcher([ |
| 471 | + { path: new MatcherPatternPathStatic('/') }, |
| 472 | + ]) |
| 473 | + matcher.resolve('two', matcher.resolve('/')) |
483 | 474 | expect('received "two"').toHaveBeenWarned() |
484 | 475 | }) |
485 | 476 |
|
|
0 commit comments