From 461f247dbe42b1c6697f7ad5f7e814e37eae4202 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 2 May 2023 15:28:53 +0200 Subject: [PATCH] test: add raw path --- src/codegen/generateRouteMap.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/codegen/generateRouteMap.spec.ts b/src/codegen/generateRouteMap.spec.ts index 8c0f09ff8..e2c218b8b 100644 --- a/src/codegen/generateRouteMap.spec.ts +++ b/src/codegen/generateRouteMap.spec.ts @@ -51,6 +51,20 @@ describe('generateRouteNamedMap', () => { `) }) + it('handles params from raw routes', () => { + const tree = createPrefixTree(DEFAULT_OPTIONS) + const a = tree.insertParsedPath(':a', 'a.vue') + const b = tree.insertParsedPath(':b()', 'a.vue') + expect(a.name).toBe('/:a') + expect(b.name).toBe('/:b()') + expect(formatExports(generateRouteNamedMap(tree))).toMatchInlineSnapshot(` + "export interface RouteNamedMap { + '/:a': RouteRecordInfo<'/:a', '/:a', { a: ParamValue }, { a: ParamValue }>, + '/:b()': RouteRecordInfo<'/:b()', '/:b()', { b: ParamValue }, { b: ParamValue }>, + }" + `) + }) + it('handles nested params in folders', () => { const tree = createPrefixTree(DEFAULT_OPTIONS) tree.insert('n/[a]/index.vue') // normal