File tree 1 file changed +26
-0
lines changed
packages/keyring-controller/src
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2923,6 +2923,32 @@ describe('KeyringController', () => {
2923
2923
) ;
2924
2924
} ) ;
2925
2925
2926
+ it ( 'should unlock the wallet also if encryption parameters are outdated the vault upgrade fails' , async ( ) => {
2927
+ await withController (
2928
+ {
2929
+ skipVaultCreation : true ,
2930
+ cacheEncryptionKey,
2931
+ state : { vault : 'my vault' } ,
2932
+ } ,
2933
+ async ( { controller, encryptor } ) => {
2934
+ jest . spyOn ( encryptor , 'isVaultUpdated' ) . mockReturnValue ( false ) ;
2935
+ jest . spyOn ( encryptor , 'encrypt' ) . mockRejectedValue ( new Error ( ) ) ;
2936
+ jest . spyOn ( encryptor , 'decrypt' ) . mockResolvedValueOnce ( [
2937
+ {
2938
+ type : KeyringTypes . hd ,
2939
+ data : {
2940
+ accounts : [ '0x123' ] ,
2941
+ } ,
2942
+ } ,
2943
+ ] ) ;
2944
+
2945
+ await controller . submitPassword ( password ) ;
2946
+
2947
+ expect ( controller . state . isUnlocked ) . toBe ( true ) ;
2948
+ } ,
2949
+ ) ;
2950
+ } ) ;
2951
+
2926
2952
it ( 'should unlock the wallet discarding existing duplicate accounts' , async ( ) => {
2927
2953
stubKeyringClassWithAccount ( MockKeyring , '0x123' ) ;
2928
2954
// @ts -expect-error HdKeyring is not yet compatible with Keyring type.
You can’t perform that action at this time.
0 commit comments