@@ -39,6 +39,7 @@ describe('idx/proceed', () => {
3939 urls : { authorizeUrl : 'meta-authorizeUrl' } ,
4040 ignoreSignature : true ,
4141 } ;
42+ const savedIdxResponse = { stateHandle : 'fake-stateHandle' } ;
4243 const authClient = {
4344 options : {
4445 issuer,
@@ -48,6 +49,7 @@ describe('idx/proceed', () => {
4849 transactionManager : {
4950 exists : ( ) => true ,
5051 load : ( ) => transactionMeta ,
52+ loadIdxResponse : ( ) => { } ,
5153 clear : ( ) => { } ,
5254 save : ( ) => { } ,
5355 } ,
@@ -62,16 +64,22 @@ describe('idx/proceed', () => {
6264 redirectUri,
6365 stateHandle,
6466 transactionMeta,
67+ savedIdxResponse,
6568 authClient
6669 } ;
6770 } ) ;
6871
6972 describe ( 'canProceed' , ( ) => {
70- it ( 'returns true if there is a saved transaction' , ( ) => {
73+ it ( 'returns true if there is a saved transaction meta ' , ( ) => {
7174 const { authClient, transactionMeta } = testContext ;
7275 jest . spyOn ( mocked . transactionMeta , 'getSavedTransactionMeta' ) . mockReturnValue ( transactionMeta ) ;
7376 expect ( canProceed ( authClient ) ) . toBe ( true ) ;
7477 } ) ;
78+ it ( 'returns true if there is a saved idxTransaction' , ( ) => {
79+ const { authClient, savedIdxResponse } = testContext ;
80+ jest . spyOn ( authClient . transactionManager , 'loadIdxResponse' ) . mockReturnValue ( savedIdxResponse ) ;
81+ expect ( canProceed ( authClient ) ) . toBe ( true ) ;
82+ } ) ;
7583 it ( 'returns false if there is no saved transaction' , ( ) => {
7684 const { authClient } = testContext ;
7785 jest . spyOn ( mocked . transactionMeta , 'getSavedTransactionMeta' ) . mockReturnValue ( undefined ) ;
0 commit comments