@@ -88,28 +88,33 @@ describe("Utils - RouterParserUtil", () => {
8888 ) . to . equal ( '[{path:"USER/CREATE"}]' ) ;
8989 } ) ;
9090
91- // ── Standalone property-access chains — preserved for enum fallback ──
92- // Property-access chains as standalone values are intentionally left unquoted so
93- // the enum-resolution fallback in constructRoutesTree() can resolve them.
91+ // ── Standalone property-access chains — normalized for safe parsing ──
9492
95- it ( "should leave a standalone property-access chain unquoted (enum fallback handles it) " , ( ) => {
93+ it ( "should quote a standalone property-access chain to keep JSON5 parseable " , ( ) => {
9694 expect (
9795 routerParser . cleanRawRoute ( "[{path:AppRoutes.center}]" ) ,
98- ) . to . equal ( " [{path:AppRoutes.center}]" ) ;
96+ ) . to . equal ( ' [{path:" AppRoutes.center"}]' ) ;
9997 } ) ;
10098
101- it ( "should leave a deep property-access chain unquoted " , ( ) => {
99+ it ( "should quote a deep property-access chain" , ( ) => {
102100 expect (
103101 routerParser . cleanRawRoute ( "[{path:AppRoutes.shared.main}]" ) ,
104- ) . to . equal ( " [{path:AppRoutes.shared.main}]" ) ;
102+ ) . to . equal ( ' [{path:" AppRoutes.shared.main"}]' ) ;
105103 } ) ;
106104
107- it ( "should leave enum references in data objects unquoted " , ( ) => {
105+ it ( "should quote enum references in data objects" , ( ) => {
108106 const result = routerParser . cleanRawRoute (
109107 '[{path:"x",data:{mode:NemoViewerMode.PATIENT}}]' ,
110108 ) ;
111- expect ( result ) . to . include ( "NemoViewerMode.PATIENT" ) ;
112- expect ( result ) . not . to . include ( ':"NemoViewerMode.PATIENT"' ) ;
109+ expect ( result ) . to . include ( ':"NemoViewerMode.PATIENT"' ) ;
110+ } ) ;
111+
112+ it ( 'should normalize CodeGenerator dotted output like "Enum"."VALUE" (issue #1417)' , ( ) => {
113+ expect (
114+ routerParser . cleanRawRoute (
115+ '[{"data":{"mode":"NemoViewerMode"."PATIENT"}}]' ,
116+ ) ,
117+ ) . to . equal ( '[{"data":{"mode":"NemoViewerMode.PATIENT"}}]' ) ;
113118 } ) ;
114119
115120 it ( "should not quote JSON5 reserved identifiers (true/false/null)" , ( ) => {
@@ -262,6 +267,18 @@ describe("Utils - RouterParserUtil", () => {
262267 } ) . not . to . throw ( ) ;
263268 expect ( result [ 0 ] . data . fn ) . to . equal ( "[Function]" ) ;
264269 } ) ;
270+
271+ it ( "should allow JSON5.parse to succeed with unresolved dotted references in values and arrays (issue #1417)" , ( ) => {
272+ const cleaned = routerParser . cleanRawRoute (
273+ '[{"data":{"mode":"NemoViewerMode"."PATIENT","allowed":["UserTypes"."UserType2"]}}]' ,
274+ ) ;
275+ let result : any ;
276+ expect ( ( ) => {
277+ result = require ( "json5" ) . parse ( cleaned ) ;
278+ } ) . not . to . throw ( ) ;
279+ expect ( result [ 0 ] . data . mode ) . to . equal ( "NemoViewerMode.PATIENT" ) ;
280+ expect ( result [ 0 ] . data . allowed [ 0 ] ) . to . equal ( "UserTypes.UserType2" ) ;
281+ } ) ;
265282 } ) ;
266283
267284 describe ( "cleanFileDynamics() — template literals in route path (issue #1493)" , ( ) => {
0 commit comments