@@ -2,7 +2,6 @@ import { deepStrictEqual as equal, ok } from "assert";
22import {
33 Comment ,
44 CommentTag ,
5- type ContainerReflection ,
65 LiteralType ,
76 Reflection ,
87 ReflectionKind ,
@@ -14,20 +13,6 @@ import { TestLogger } from "./TestLogger.js";
1413import { getComment , getSigComment , query , querySig , reflToTree } from "./utils.js" ;
1514import { getConverter2App , getConverter2Project } from "./programs.js" ;
1615
17- type NameTree = { [ name : string ] : NameTree | undefined } ;
18-
19- function buildNameTree (
20- refl : ContainerReflection ,
21- tree : NameTree = { } ,
22- ) : NameTree {
23- for ( const child of refl . children || [ ] ) {
24- tree [ child . name ] ||= { } ;
25- buildNameTree ( child , tree [ child . name ] ) ;
26- }
27-
28- return tree ;
29- }
30-
3116function getLinks ( refl : Reflection ) {
3217 ok ( refl . comment ) ;
3318 return filterMap ( refl . comment . summary , ( p ) => {
@@ -419,11 +404,11 @@ describe("Behavior Tests", () => {
419404 app . options . setValue ( "excludeNotDocumented" , true ) ;
420405 app . options . setValue ( "excludeNotDocumentedKinds" , [ "Property" ] ) ;
421406 const project = convert ( "excludeNotDocumentedKinds" ) ;
422- equal ( buildNameTree ( project ) , {
407+ equal ( reflToTree ( project ) , {
423408 NotDoc : {
424- prop : { } ,
409+ prop : "Property" ,
425410 } ,
426- identity : { } ,
411+ identity : "Function" ,
427412 } ) ;
428413 } ) ;
429414
@@ -1526,4 +1511,25 @@ describe("Behavior Tests", () => {
15261511 // Inherits description from class's @template
15271512 equal ( Comment . combineDisplayParts ( ctor . signatures [ 1 ] . typeParameters ?. [ 0 ] . comment ?. summary ) , "class docs" ) ;
15281513 } ) ;
1514+
1515+ it ( "Supports the @alias tag" , ( ) => {
1516+ const project = convert ( "alias" ) ;
1517+
1518+ logger . expectMessage ( "warn: Failed to convert BadAlias as an alias because it is not direct reference." ) ;
1519+
1520+ equal ( reflToTree ( project ) , {
1521+ Math : {
1522+ BadAlias : "TypeAlias" ,
1523+ IsInt : "TypeAlias" ,
1524+ Vec : {
1525+ "Constructor:constructor" : "Constructor" ,
1526+ mag : "Method" ,
1527+ } ,
1528+ makeVec : "Function" ,
1529+ } ,
1530+ } ) ;
1531+
1532+ const bad = query ( project , "Math.BadAlias" ) ;
1533+ equal ( bad . comment ?. modifierTags , new Set ( [ "@alias" ] ) ) ;
1534+ } ) ;
15291535} ) ;
0 commit comments