@@ -852,4 +852,57 @@ describe('Injector', () => {
852852 expect ( optionalDependenciesIds ) . to . deep . eq ( [ 1 ] ) ;
853853 } ) ;
854854 } ) ;
855+
856+ describe ( 'addDependencyMetadata' , ( ) => {
857+ interface IInjector extends Omit < Injector , 'addDependencyMetadata' > {
858+ addDependencyMetadata : (
859+ keyOrIndex : symbol | string | number ,
860+ hostWrapper : InstanceWrapper ,
861+ instanceWrapper : InstanceWrapper ,
862+ ) => void ;
863+ }
864+
865+ let exposedInjector : IInjector ;
866+ let hostWrapper : InstanceWrapper ;
867+ let instanceWrapper : InstanceWrapper ;
868+
869+ beforeEach ( ( ) => {
870+ exposedInjector = injector as unknown as IInjector ;
871+ hostWrapper = new InstanceWrapper ( ) ;
872+ instanceWrapper = new InstanceWrapper ( ) ;
873+ } ) ;
874+
875+ it ( 'should add dependency metadata to PropertiesMetadata when key is symbol' , async ( ) => {
876+ const addPropertiesMetadataSpy = sinon . spy (
877+ hostWrapper ,
878+ 'addPropertiesMetadata' ,
879+ ) ;
880+
881+ const key = Symbol . for ( 'symbol' ) ;
882+ exposedInjector . addDependencyMetadata ( key , hostWrapper , instanceWrapper ) ;
883+
884+ expect ( addPropertiesMetadataSpy . called ) . to . be . true ;
885+ } ) ;
886+
887+ it ( 'should add dependency metadata to PropertiesMetadata when key is string' , async ( ) => {
888+ const addPropertiesMetadataSpy = sinon . spy (
889+ hostWrapper ,
890+ 'addPropertiesMetadata' ,
891+ ) ;
892+
893+ const key = 'string' ;
894+ exposedInjector . addDependencyMetadata ( key , hostWrapper , instanceWrapper ) ;
895+
896+ expect ( addPropertiesMetadataSpy . called ) . to . be . true ;
897+ } ) ;
898+
899+ it ( 'should add dependency metadata to CtorMetadata when key is number' , async ( ) => {
900+ const addCtorMetadataSpy = sinon . spy ( hostWrapper , 'addCtorMetadata' ) ;
901+
902+ const key = 0 ;
903+ exposedInjector . addDependencyMetadata ( key , hostWrapper , instanceWrapper ) ;
904+
905+ expect ( addCtorMetadataSpy . called ) . to . be . true ;
906+ } ) ;
907+ } ) ;
855908} ) ;
0 commit comments