Skip to content

Commit 6952935

Browse files
authored
test: nested index routes (#606)
1 parent c92fcb0 commit 6952935

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/codegen/generateRouteMap.spec.ts

+16
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ describe('generateRouteNamedMap', () => {
148148
`)
149149
})
150150

151+
it('nested index routes', () => {
152+
const tree = new PrefixTree(DEFAULT_OPTIONS)
153+
tree.insert('a', 'a.vue')
154+
tree.insert('a/index', 'a/index.vue')
155+
tree.insert('a/[id]', 'a/[id].vue')
156+
tree.insert('a/[id]/index', 'a/[id]/index.vue')
157+
expect(formatExports(generateRouteNamedMap(tree))).toMatchInlineSnapshot(`
158+
"export interface RouteNamedMap {
159+
'/a': RouteRecordInfo<'/a', '/a', Record<never, never>, Record<never, never>>,
160+
'/a/': RouteRecordInfo<'/a/', '/a', Record<never, never>, Record<never, never>>,
161+
'/a/[id]': RouteRecordInfo<'/a/[id]', '/a/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
162+
'/a/[id]/': RouteRecordInfo<'/a/[id]/', '/a/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
163+
}"
164+
`)
165+
})
166+
151167
it('keeps parent path overrides', () => {
152168
const tree = new PrefixTree(DEFAULT_OPTIONS)
153169
const parent = tree.insert('parent', 'parent.vue')

0 commit comments

Comments
 (0)