@@ -185,6 +185,16 @@ describe("Utils - RouterParserUtil", () => {
185185 expect ( result ) . not . to . include ( "[Function]" ) ;
186186 } ) ;
187187
188+ it ( 'should convert loadComponent default-export syntax to "path#default" string (issue #1363)' , ( ) => {
189+ const result = routerParser . cleanRawRoute (
190+ "[{path:'faq',loadComponent:()=>import('./pages/faq/faq.component')}]" ,
191+ ) ;
192+ expect ( result ) . to . include (
193+ 'loadComponent:"./pages/faq/faq.component#default"' ,
194+ ) ;
195+ expect ( result ) . not . to . include ( "[Function]" ) ;
196+ } ) ;
197+
188198 // ── CodeGenerator output format (issue #1546) ────────────────────────
189199 // CodeGenerator wraps identifiers in double quotes and produces:
190200 // "loadComponent":()=>import("path")."then"("m"=>"m"."Module")
@@ -632,6 +642,46 @@ const routes: Route[] = [
632642 ] ) ;
633643 } ) ;
634644
645+ it ( "should keep unresolved enum member references in data arrays JSON5-parseable (issue #1366)" , ( ) => {
646+ const project = new Project ( { useInMemoryFileSystem : true } ) ;
647+ const sourceFile = project . createSourceFile (
648+ "/tmp/feature-routing-1366.module.ts" ,
649+ `
650+ import { Routes } from "@angular/router";
651+ import { PermissionCode } from "@shared/permissions";
652+
653+ const routes: Routes = [
654+ {
655+ path: "",
656+ component: "MapPageComponent",
657+ data: {
658+ permissions: [PermissionCode.Map_View]
659+ }
660+ }
661+ ];
662+ ` ,
663+ ) ;
664+
665+ routerParser . cleanFileSpreads ( sourceFile ) ;
666+ routerParser . cleanCallExpressions ( sourceFile ) ;
667+ routerParser . cleanFileDynamics ( sourceFile ) ;
668+
669+ const initializer = sourceFile
670+ . getVariableDeclarationOrThrow ( "routes" )
671+ . getInitializerOrThrow ( ) . compilerNode ;
672+ const generated = new CodeGenerator ( ) . generate ( initializer ) ;
673+ const cleaned = routerParser . cleanRawRoute ( generated ) ;
674+
675+ let parsed : any ;
676+ expect ( ( ) => {
677+ parsed = require ( "json5" ) . parse ( cleaned ) ;
678+ } ) . not . to . throw ( ) ;
679+
680+ expect ( parsed [ 0 ] . data . permissions ) . to . deep . equal ( [
681+ "PermissionCode.Map_View" ,
682+ ] ) ;
683+ } ) ;
684+
635685 it ( "should allow resolve callbacks using inject() in feature Route[] declarations (issue #1433)" , ( ) => {
636686 const project = new Project ( { useInMemoryFileSystem : true } ) ;
637687 const sourceFile = project . createSourceFile (
0 commit comments