@@ -254,7 +254,7 @@ describe("tags", () => {
254254 const tagType = sourceFile . getTypeAlias ( "Tag" ) ;
255255 assert ( tagType ) ;
256256 assert ( tagType . isExported ( ) ) ;
257- const tagTypeText = tagType . getType ( ) . getText ( ) ;
257+ const tagTypeText = tagType . getTypeNode ( ) ? .getText ( ) || "" ;
258258 assert . match ( tagTypeText , / " p e t " / ) ;
259259 assert . match ( tagTypeText , / " u s e r " / ) ;
260260 } ) ;
@@ -284,7 +284,7 @@ describe("tags", () => {
284284 const tagType = sourceFile . getTypeAlias ( "Tag" ) ;
285285 assert ( tagType ) ;
286286 assert ( tagType . isExported ( ) ) ;
287- const tagTypeText = tagType . getType ( ) . getText ( ) ;
287+ const tagTypeText = tagType . getTypeNode ( ) ? .getText ( ) || "" ;
288288 assert . equal ( tagTypeText , "null" ) ;
289289 } ) ;
290290
@@ -327,7 +327,7 @@ describe("tags", () => {
327327 const sourceFile = generate ( spec , "./schema.d.ts" , "outdir.ts" ) ;
328328 const tagType = sourceFile . getTypeAlias ( "Tag" ) ;
329329 assert ( tagType ) ;
330- const tagTypeText = tagType . getType ( ) . getText ( ) ;
330+ const tagTypeText = tagType . getTypeNode ( ) ? .getText ( ) || "" ;
331331 assert . match ( tagTypeText , / " p e t " / ) ;
332332 assert . match ( tagTypeText , / n u l l / ) ;
333333 } ) ;
@@ -371,9 +371,11 @@ describe("registerRouteHandlersByTag", () => {
371371 const serverParam = func . getParameters ( ) [ 1 ] ;
372372 assert ( serverParam ) ;
373373 assert . equal ( serverParam . getName ( ) , "server" ) ;
374- assert . match ( serverParam . getType ( ) . getText ( ) , / P a r t i a l < S e r v e r < R e q , R e s > > / ) ;
374+ const serverTypeText = serverParam . getTypeNode ( ) ?. getText ( ) || "" ;
375+ assert . match ( serverTypeText , / P a r t i a l < S e r v e r < R e q , R e s > > / ) ;
375376
376- assert . match ( func . getReturnType ( ) . getText ( ) , / R o u t e \[ \] / ) ;
377+ const returnTypeText = func . getReturnTypeNode ( ) ?. getText ( ) || "" ;
378+ assert . match ( returnTypeText , / R o u t e \[ \] / ) ;
377379 } ) ;
378380
379381 it ( "generates switch statement for each tag" , ( ) => {
@@ -420,8 +422,8 @@ describe("registerRouteHandlersByTag", () => {
420422 assert . match ( bodyText , / s w i t c h \( t a g \) / ) ;
421423 assert . match ( bodyText , / c a s e " p e t " : / ) ;
422424 assert . match ( bodyText , / c a s e " u s e r " : / ) ;
423- assert . match ( bodyText , / i f \( s e r v e r \. l i s t P e t s \) / ) ;
424- assert . match ( bodyText , / i f \( s e r v e r \. l i s t U s e r s \) / ) ;
425+ assert . match ( bodyText , / h a n d l e r : s e r v e r \. l i s t P e t s / ) ;
426+ assert . match ( bodyText , / h a n d l e r : s e r v e r \. l i s t U s e r s / ) ;
425427 } ) ;
426428
427429 it ( "groups operations by tag correctly" , ( ) => {
@@ -467,8 +469,8 @@ describe("registerRouteHandlersByTag", () => {
467469 const petCaseMatch = bodyText . match ( / c a s e " p e t " : [ \s \S ] * ?b r e a k ; / ) ;
468470 assert ( petCaseMatch ) ;
469471 const petCaseBlock = petCaseMatch [ 0 ] ;
470- assert . match ( petCaseBlock , / i f \( s e r v e r \. l i s t P e t s \) / ) ;
471- assert . match ( petCaseBlock , / i f \( s e r v e r \. c r e a t e P e t \) / ) ;
472+ assert . match ( petCaseBlock , / h a n d l e r : s e r v e r \. l i s t P e t s / ) ;
473+ assert . match ( petCaseBlock , / h a n d l e r : s e r v e r \. c r e a t e P e t / ) ;
472474 } ) ;
473475
474476 it ( "handles untagged operations with null case" , ( ) => {
@@ -497,7 +499,7 @@ describe("registerRouteHandlersByTag", () => {
497499 const bodyText = func ?. getBodyText ( ) || "" ;
498500
499501 assert . match ( bodyText , / c a s e n u l l : / ) ;
500- assert . match ( bodyText , / i f \( s e r v e r \. g e t S t a t u s \) / ) ;
502+ assert . match ( bodyText , / h a n d l e r : s e r v e r \. g e t S t a t u s / ) ;
501503 } ) ;
502504} ) ;
503505
0 commit comments