@@ -180,30 +180,34 @@ describe("unittests:: Public APIs:: validateLocaleAndSetLanguage", () => {
180180} ) ;
181181
182182describe ( "unittests:: Public APIs :: forEachChild of @param comments in JSDoc" , ( ) => {
183- const content = `
183+ it ( "finds correct children" , ( ) => {
184+ const content = `
184185/**
185186 * @param The {@link TypeReferencesInAedoc}.
186187 */
187188var x
188189` ;
189- const sourceFile = ts . createSourceFile ( "/file.ts" , content , ts . ScriptTarget . ESNext , /*setParentNodes*/ true ) ;
190- const paramTag = sourceFile . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] ;
191- const kids = paramTag . getChildren ( ) ;
192- const seen : Set < ts . Node > = new Set ( ) ;
193- ts . forEachChild ( paramTag , n => {
194- assert . strictEqual ( /*actual*/ false , seen . has ( n ) , "Found a duplicate-added child" ) ;
195- seen . add ( n ) ;
190+ const sourceFile = ts . createSourceFile ( "/file.ts" , content , ts . ScriptTarget . ESNext , /*setParentNodes*/ true ) ;
191+ const paramTag = sourceFile . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] . getChildren ( ) [ 0 ] ;
192+ const kids = paramTag . getChildren ( ) ;
193+ const seen : Set < ts . Node > = new Set ( ) ;
194+ ts . forEachChild ( paramTag , n => {
195+ assert . strictEqual ( /*actual*/ false , seen . has ( n ) , "Found a duplicate-added child" ) ;
196+ seen . add ( n ) ;
197+ } ) ;
198+ assert . equal ( 5 , kids . length ) ;
196199 } ) ;
197- assert . equal ( 5 , kids . length ) ;
198200} ) ;
199201
200202describe ( "unittests:: Public APIs:: getChild* methods on EndOfFileToken with JSDoc" , ( ) => {
201- const content = `
203+ it ( "finds correct children" , ( ) => {
204+ const content = `
202205/** jsdoc comment attached to EndOfFileToken */
203206` ;
204- const sourceFile = ts . createSourceFile ( "/file.ts" , content , ts . ScriptTarget . ESNext , /*setParentNodes*/ true ) ;
205- const endOfFileToken = sourceFile . getChildren ( ) [ 1 ] ;
206- assert . equal ( endOfFileToken . getChildren ( ) . length , 1 ) ;
207- assert . equal ( endOfFileToken . getChildCount ( ) , 1 ) ;
208- assert . notEqual ( endOfFileToken . getChildAt ( 0 ) , /*expected*/ undefined ) ;
207+ const sourceFile = ts . createSourceFile ( "/file.ts" , content , ts . ScriptTarget . ESNext , /*setParentNodes*/ true ) ;
208+ const endOfFileToken = sourceFile . getChildren ( ) [ 1 ] ;
209+ assert . equal ( endOfFileToken . getChildren ( ) . length , 1 ) ;
210+ assert . equal ( endOfFileToken . getChildCount ( ) , 1 ) ;
211+ assert . notEqual ( endOfFileToken . getChildAt ( 0 ) , /*expected*/ undefined ) ;
212+ } ) ;
209213} ) ;
0 commit comments