@@ -8,11 +8,13 @@ import { ResolutionContextMocked } from '../ResolutionContextMocked';
88describe ( 'ParameterResolver' , ( ) => {
99 const resolutionContext = new ResolutionContextMocked ( { } ) ;
1010 let classLoader : ClassLoader ;
11+ let ignoreClasses : Record < string , boolean > ;
1112 let loader : ParameterResolver ;
1213
1314 beforeEach ( ( ) => {
1415 classLoader = new ClassLoader ( { resolutionContext } ) ;
15- loader = new ParameterResolver ( { classLoader } ) ;
16+ ignoreClasses = { } ;
17+ loader = new ParameterResolver ( { classLoader, ignoreClasses } ) ;
1618 } ) ;
1719
1820 describe ( 'resolveAllConstructorParameters' , ( ) => {
@@ -263,6 +265,20 @@ describe('ParameterResolver', () => {
263265 } ) ;
264266 } ) ;
265267
268+ it ( 'should handle an ignored interface range pointing to a class' , async ( ) => {
269+ ignoreClasses . MyClass = true ;
270+ resolutionContext . contentsOverrides = {
271+ 'A.d.ts' : `export * from 'MyClass'` ,
272+ 'MyClass.d.ts' : `export class MyClass{}` ,
273+ } ;
274+ expect ( await loader . resolveRange ( {
275+ type : 'interface' ,
276+ value : 'MyClass' ,
277+ } , classReference ) ) . toMatchObject ( {
278+ type : 'undefined' ,
279+ } ) ;
280+ } ) ;
281+
266282 it ( 'should handle an interface range pointing to an implicit class' , async ( ) => {
267283 resolutionContext . contentsOverrides = {
268284 'A.d.ts' : `export * from 'MyClass'` ,
@@ -300,8 +316,23 @@ describe('ParameterResolver', () => {
300316 } ,
301317 ] ,
302318 } ) ;
319+ } ) ;
303320
304- // TODO: hash
321+ it ( 'should handle an interface range pointing to a extended interface that is ignored' , async ( ) => {
322+ ignoreClasses . IgnoredInterface = true ;
323+ resolutionContext . contentsOverrides = {
324+ 'A.d.ts' : `export * from 'MyInterface'` ,
325+ 'MyInterface.d.ts' : `
326+ export interface MyInterface extends IgnoredInterface{};
327+ ` ,
328+ } ;
329+ expect ( await loader . resolveRange ( {
330+ type : 'interface' ,
331+ value : 'MyInterface' ,
332+ } , classReference ) ) . toMatchObject ( {
333+ type : 'nested' ,
334+ value : [ ] ,
335+ } ) ;
305336 } ) ;
306337 } ) ;
307338
@@ -562,6 +593,30 @@ declare interface C{}
562593 } ) ;
563594 } ) ;
564595
596+ it ( 'should load an interface with supers and consider ignored classes' , async ( ) => {
597+ ignoreClasses . C = true ;
598+ resolutionContext . contentsOverrides = {
599+ 'A.d.ts' : `
600+ export interface A extends B, C{}
601+ export interface B{}
602+ declare interface C{}
603+ ` ,
604+ } ;
605+ expect ( await loader . loadClassOrInterfacesChain ( classReference ) )
606+ . toMatchObject ( {
607+ fileName : 'A' ,
608+ localName : 'A' ,
609+ type : 'interface' ,
610+ superInterfaces : [
611+ {
612+ fileName : 'A' ,
613+ localName : 'B' ,
614+ type : 'interface' ,
615+ } ,
616+ ] ,
617+ } ) ;
618+ } ) ;
619+
565620 it ( 'should load an interface with supers over different files' , async ( ) => {
566621 resolutionContext . contentsOverrides = {
567622 'A.d.ts' : `
0 commit comments