@@ -128,6 +128,66 @@ describe("URLSpec Builder", () => {
128128 expect ( result ) . toContain ( "page rejectedList = /jobs/rejected" ) ;
129129 } ) ;
130130
131+ describe ( "Comment/Description Support" , ( ) => {
132+ it ( "should output page comments" , ( ) => {
133+ const spec = new URLSpec ( ) ;
134+ spec . addPage ( {
135+ name : "list" ,
136+ path : "/jobs" ,
137+ comment : "Job listing page" ,
138+ } ) ;
139+ const result = spec . toString ( ) ;
140+ expect ( result ) . toContain ( "// Job listing page" ) ;
141+ expect ( result ) . toContain ( "page list = /jobs {" ) ;
142+ } ) ;
143+
144+ it ( "should output parameter comments" , ( ) => {
145+ const spec = new URLSpec ( ) ;
146+ spec . addPage ( {
147+ name : "list" ,
148+ path : "/jobs" ,
149+ parameters : [
150+ { name : "sort" , type : "string" , comment : "Sort order" } ,
151+ ] ,
152+ } ) ;
153+ const result = spec . toString ( ) ;
154+ expect ( result ) . toContain ( " // Sort order" ) ;
155+ expect ( result ) . toContain ( " sort: string;" ) ;
156+ } ) ;
157+
158+ it ( "should output param type comments" , ( ) => {
159+ const spec = new URLSpec ( ) ;
160+ spec . addParamType ( "sortOrder" , [ "recent" , "popular" ] , "Available sort orders" ) ;
161+ spec . addPage ( { name : "list" , path : "/jobs" } ) ;
162+ const result = spec . toString ( ) ;
163+ expect ( result ) . toContain ( "// Available sort orders" ) ;
164+ } ) ;
165+
166+ it ( "should output global parameter comments" , ( ) => {
167+ const spec = new URLSpec ( ) ;
168+ spec . addGlobalParam ( {
169+ name : "utm_source" ,
170+ type : "string" ,
171+ optional : true ,
172+ comment : "UTM source tracking" ,
173+ } ) ;
174+ spec . addPage ( { name : "list" , path : "/jobs" } ) ;
175+ const result = spec . toString ( ) ;
176+ expect ( result ) . toContain ( " // UTM source tracking" ) ;
177+ } ) ;
178+
179+ it ( "should output multi-line comments" , ( ) => {
180+ const spec = new URLSpec ( ) ;
181+ spec . addPage ( {
182+ name : "list" ,
183+ path : "/jobs" ,
184+ comment : "Job listing page\nDisplays all available jobs" ,
185+ } ) ;
186+ const result = spec . toString ( ) ;
187+ expect ( result ) . toContain ( "// Job listing page\n// Displays all available jobs" ) ;
188+ } ) ;
189+ } ) ;
190+
131191 describe ( "Security - Path Traversal Prevention" , ( ) => {
132192 it ( "should reject paths with .. traversal sequences" , async ( ) => {
133193 const spec = new URLSpec ( ) ;
0 commit comments