]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: move old file
authorEduardo San Martin Morote <posva13@gmail.com>
Sat, 16 Aug 2025 13:38:29 +0000 (15:38 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sat, 16 Aug 2025 13:38:29 +0000 (15:38 +0200)
packages/router/src/experimental/route-resolver/old/matcher-resolve.spec.ts [moved from packages/router/src/experimental/route-resolver/matcher-resolve.spec.ts with 64% similarity]

similarity index 64%
rename from packages/router/src/experimental/route-resolver/matcher-resolve.spec.ts
rename to packages/router/src/experimental/route-resolver/old/matcher-resolve.spec.ts
index 1b3051c2e68bd4a3c51d062876689087139efd73..7b1720cd03d95eb81cf520fa94f29364f26663a8 100644 (file)
@@ -1,34 +1,34 @@
 import { describe, expect, it } from 'vitest'
 import { defineComponent } from 'vue'
-import { RouteComponent, RouteMeta, RouteRecordRaw } from '../../types'
-import { NEW_stringifyURL } from '../../location'
-import { mockWarn } from '../../../__tests__/vitest-mock-warn'
+import { RouteComponent, RouteMeta, RouteRecordRaw } from '../../../types'
+import { NEW_stringifyURL } from '../../../location'
+import { mockWarn } from '../../../../__tests__/vitest-mock-warn'
 import {
   type MatcherLocationRaw,
   type ResolverLocationResolved,
   NO_MATCH_LOCATION,
-} from './resolver-abstract'
-import { type NEW_MatcherRecord } from './old/resolver-dynamic'
-import { type NEW_MatcherRecordRaw } from './old/resolver-dynamic'
-import { createCompiledMatcher } from './old/resolver-dynamic'
-import { miss } from './matchers/errors'
+} from '../resolver-abstract'
+import { type NEW_MatcherRecord } from './resolver-dynamic'
+import { type NEW_MatcherRecordRaw } from './resolver-dynamic'
+import { createCompiledMatcher } from './resolver-dynamic'
+import { miss } from '../matchers/errors'
 import {
   MatcherPatternPath,
   MatcherPatternPathStatic,
-} from './matchers/matcher-pattern'
-import { EXPERIMENTAL_RouterOptions } from '../router'
-import { stringifyQuery } from '../../query'
-import type { ResolverLocationAsPathAbsolute } from './resolver-abstract'
-import type { ResolverLocationAsNamed } from './resolver-abstract'
+} from '../matchers/matcher-pattern'
+import { EXPERIMENTAL_RouterOptions } from '../../router'
+import { stringifyQuery } from '../../../query'
+import type { ResolverLocationAsPathAbsolute } from '../resolver-abstract'
+import type { ResolverLocationAsNamed } from '../resolver-abstract'
 // TODO: should be moved to a different test file
 // used to check backward compatible paths
 import {
   PATH_PARSER_OPTIONS_DEFAULTS,
   PathParams,
   tokensToParser,
-} from '../../matcher/pathParserRanker'
-import { tokenizePath } from '../../matcher/pathTokenizer'
-import { mergeOptions } from '../../utils'
+} from '../../../matcher/pathParserRanker'
+import { tokenizePath } from '../../../matcher/pathTokenizer'
+import { mergeOptions } from '../../../utils'
 
 // FIXME: this type was removed, it will be a new one once a dynamic resolver is implemented
 export interface EXPERIMENTAL_RouteRecordRaw extends NEW_MatcherRecordRaw {
@@ -694,502 +694,6 @@ describe('RouterMatcher.resolve', () => {
     })
   })
 
-  describe.skip('alias', () => {
-    it('resolves an alias', () => {
-      assertRecordMatch(
-        {
-          path: '/',
-          alias: '/home',
-          name: 'Home',
-          components,
-          meta: { foo: true },
-        },
-        { path: '/home' },
-        {
-          name: 'Home',
-          path: '/home',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/home',
-            //   name: 'Home',
-            //   components,
-            //   aliasOf: expect.objectContaining({ name: 'Home', path: '/' }),
-            //   meta: { foo: true },
-            // },
-          ],
-        }
-      )
-    })
-
-    it('multiple aliases', () => {
-      const record = {
-        path: '/',
-        alias: ['/home', '/start'],
-        name: 'Home',
-        components,
-        meta: { foo: true },
-      }
-
-      assertRecordMatch(
-        record,
-        { path: '/' },
-        {
-          name: 'Home',
-          path: '/',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/',
-            //   name: 'Home',
-            //   components,
-            //   aliasOf: undefined,
-            //   meta: { foo: true },
-            // },
-          ],
-        }
-      )
-      assertRecordMatch(
-        record,
-        { path: '/home' },
-        {
-          name: 'Home',
-          path: '/home',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/home',
-            //   name: 'Home',
-            //   components,
-            //   aliasOf: expect.objectContaining({ name: 'Home', path: '/' }),
-            //   meta: { foo: true },
-            // },
-          ],
-        }
-      )
-      assertRecordMatch(
-        record,
-        { path: '/start' },
-        {
-          name: 'Home',
-          path: '/start',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/start',
-            //   name: 'Home',
-            //   components,
-            //   aliasOf: expect.objectContaining({ name: 'Home', path: '/' }),
-            //   meta: { foo: true },
-            // },
-          ],
-        }
-      )
-    })
-
-    it('resolves the original record by name', () => {
-      assertRecordMatch(
-        {
-          path: '/',
-          alias: '/home',
-          name: 'Home',
-          components,
-          meta: { foo: true },
-        },
-        { name: 'Home', params: {} },
-        {
-          name: 'Home',
-          path: '/',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/',
-            //   name: 'Home',
-            //   components,
-            //   aliasOf: undefined,
-            //   meta: { foo: true },
-            // },
-          ],
-        }
-      )
-    })
-
-    it('resolves an alias with children to the alias when using the path', () => {
-      const children = [{ path: 'one', component, name: 'nested' }]
-      assertRecordMatch(
-        {
-          path: '/parent',
-          alias: '/p',
-          component,
-          children,
-        },
-        { path: '/p/one' },
-        {
-          path: '/p/one',
-          name: 'nested',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/p',
-            //   children,
-            //   components,
-            //   aliasOf: expect.objectContaining({ path: '/parent' }),
-            // },
-            // {
-            //   path: '/p/one',
-            //   name: 'nested',
-            //   components,
-            //   aliasOf: expect.objectContaining({ path: '/parent/one' }),
-            // },
-          ],
-        }
-      )
-    })
-
-    describe('nested aliases', () => {
-      const children = [
-        {
-          path: 'one',
-          component,
-          name: 'nested',
-          alias: 'o',
-          children: [
-            { path: 'two', alias: 't', name: 'nestednested', component },
-          ],
-        },
-        {
-          path: 'other',
-          alias: 'otherAlias',
-          component,
-          name: 'other',
-        },
-      ]
-      const record = {
-        path: '/parent',
-        name: 'parent',
-        alias: '/p',
-        component,
-        children,
-      }
-
-      it('resolves the parent as an alias', () => {
-        assertRecordMatch(
-          record,
-          { path: '/p' },
-          expect.objectContaining({
-            path: '/p',
-            name: 'parent',
-            matched: [
-              expect.objectContaining({
-                path: '/p',
-                aliasOf: expect.objectContaining({ path: '/parent' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      describe('multiple children', () => {
-        // tests concerning the /parent/other path and its aliases
-
-        it('resolves the alias parent', () => {
-          assertRecordMatch(
-            record,
-            { path: '/p/other' },
-            expect.objectContaining({
-              path: '/p/other',
-              name: 'other',
-              matched: [
-                expect.objectContaining({
-                  path: '/p',
-                  aliasOf: expect.objectContaining({ path: '/parent' }),
-                }),
-                expect.objectContaining({
-                  path: '/p/other',
-                  aliasOf: expect.objectContaining({ path: '/parent/other' }),
-                }),
-              ],
-            })
-          )
-        })
-
-        it('resolves the alias child', () => {
-          assertRecordMatch(
-            record,
-            { path: '/parent/otherAlias' },
-            expect.objectContaining({
-              path: '/parent/otherAlias',
-              name: 'other',
-              matched: [
-                expect.objectContaining({
-                  path: '/parent',
-                  aliasOf: undefined,
-                }),
-                expect.objectContaining({
-                  path: '/parent/otherAlias',
-                  aliasOf: expect.objectContaining({ path: '/parent/other' }),
-                }),
-              ],
-            })
-          )
-        })
-
-        it('resolves the alias parent and child', () => {
-          assertRecordMatch(
-            record,
-            { path: '/p/otherAlias' },
-            expect.objectContaining({
-              path: '/p/otherAlias',
-              name: 'other',
-              matched: [
-                expect.objectContaining({
-                  path: '/p',
-                  aliasOf: expect.objectContaining({ path: '/parent' }),
-                }),
-                expect.objectContaining({
-                  path: '/p/otherAlias',
-                  aliasOf: expect.objectContaining({ path: '/parent/other' }),
-                }),
-              ],
-            })
-          )
-        })
-      })
-
-      it('resolves the original one with no aliases', () => {
-        assertRecordMatch(
-          record,
-          { path: '/parent/one/two' },
-          expect.objectContaining({
-            path: '/parent/one/two',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/parent',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/one',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/one/two',
-                aliasOf: undefined,
-              }),
-            ],
-          })
-        )
-      })
-
-      it.todo('resolves when parent is an alias and child has an absolute path')
-
-      it('resolves when parent is an alias', () => {
-        assertRecordMatch(
-          record,
-          { path: '/p/one/two' },
-          expect.objectContaining({
-            path: '/p/one/two',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/p',
-                aliasOf: expect.objectContaining({ path: '/parent' }),
-              }),
-              expect.objectContaining({
-                path: '/p/one',
-                aliasOf: expect.objectContaining({ path: '/parent/one' }),
-              }),
-              expect.objectContaining({
-                path: '/p/one/two',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves a different child when parent is an alias', () => {
-        assertRecordMatch(
-          record,
-          { path: '/p/other' },
-          expect.objectContaining({
-            path: '/p/other',
-            name: 'other',
-            matched: [
-              expect.objectContaining({
-                path: '/p',
-                aliasOf: expect.objectContaining({ path: '/parent' }),
-              }),
-              expect.objectContaining({
-                path: '/p/other',
-                aliasOf: expect.objectContaining({ path: '/parent/other' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves when the first child is an alias', () => {
-        assertRecordMatch(
-          record,
-          { path: '/parent/o/two' },
-          expect.objectContaining({
-            path: '/parent/o/two',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/parent',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/o',
-                aliasOf: expect.objectContaining({ path: '/parent/one' }),
-              }),
-              expect.objectContaining({
-                path: '/parent/o/two',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves when the second child is an alias', () => {
-        assertRecordMatch(
-          record,
-          { path: '/parent/one/t' },
-          expect.objectContaining({
-            path: '/parent/one/t',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/parent',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/one',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/one/t',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves when the two last children are aliases', () => {
-        assertRecordMatch(
-          record,
-          { path: '/parent/o/t' },
-          expect.objectContaining({
-            path: '/parent/o/t',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/parent',
-                aliasOf: undefined,
-              }),
-              expect.objectContaining({
-                path: '/parent/o',
-                aliasOf: expect.objectContaining({ path: '/parent/one' }),
-              }),
-              expect.objectContaining({
-                path: '/parent/o/t',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves when all are aliases', () => {
-        assertRecordMatch(
-          record,
-          { path: '/p/o/t' },
-          expect.objectContaining({
-            path: '/p/o/t',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/p',
-                aliasOf: expect.objectContaining({ path: '/parent' }),
-              }),
-              expect.objectContaining({
-                path: '/p/o',
-                aliasOf: expect.objectContaining({ path: '/parent/one' }),
-              }),
-              expect.objectContaining({
-                path: '/p/o/t',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-
-      it('resolves when first and last are aliases', () => {
-        assertRecordMatch(
-          record,
-          { path: '/p/one/t' },
-          expect.objectContaining({
-            path: '/p/one/t',
-            name: 'nestednested',
-            matched: [
-              expect.objectContaining({
-                path: '/p',
-                aliasOf: expect.objectContaining({ path: '/parent' }),
-              }),
-              expect.objectContaining({
-                path: '/p/one',
-                aliasOf: expect.objectContaining({ path: '/parent/one' }),
-              }),
-              expect.objectContaining({
-                path: '/p/one/t',
-                aliasOf: expect.objectContaining({ path: '/parent/one/two' }),
-              }),
-            ],
-          })
-        )
-      })
-    })
-
-    it('resolves the original path of the named children of a route with an alias', () => {
-      const children = [{ path: 'one', component, name: 'nested' }]
-      assertRecordMatch(
-        {
-          path: '/parent',
-          alias: '/p',
-          component,
-          children,
-        },
-        { name: 'nested', params: {} },
-        {
-          path: '/parent/one',
-          name: 'nested',
-          params: {},
-          matched: [
-            // TODO:
-            // {
-            //   path: '/parent',
-            //   children,
-            //   components,
-            //   aliasOf: undefined,
-            // },
-            // { path: '/parent/one', name: 'nested', components },
-          ],
-        }
-      )
-    })
-  })
-
   describe('children', () => {
     const ChildA: RouteRecordRaw = { path: 'a', name: 'child-a', components }
     const ChildB: RouteRecordRaw = { path: 'b', name: 'child-b', components }