File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -720,6 +720,16 @@ test('checkAddressesMine', async () => {
720720 ) ;
721721} ) ;
722722
723+ test ( 'checkAddressesMine with empty array' , async ( ) => {
724+ const wallet = buildWalletToAuthenticateApiCall ( ) ;
725+ jest . spyOn ( wallet , 'isReady' ) . mockReturnValue ( true ) ;
726+
727+ // Should return empty object without making API call
728+ const walletAddressMap = await wallet . checkAddressesMine ( [ ] ) ;
729+
730+ expect ( walletAddressMap ) . toStrictEqual ( { } ) ;
731+ } ) ;
732+
723733test ( 'generateCreateWalletAuthData should return correct auth data' , async ( ) => {
724734 const requestPassword = jest . fn ( ) ;
725735
Original file line number Diff line number Diff line change @@ -1646,6 +1646,10 @@ class HathorWalletServiceWallet extends EventEmitter implements IHathorWallet {
16461646 * @inner
16471647 */
16481648 async checkAddressesMine ( addresses : string [ ] ) : Promise < WalletAddressMap > {
1649+ if ( addresses . length === 0 ) {
1650+ return { } ;
1651+ }
1652+
16491653 const response = await walletApi . checkAddressesMine ( this , addresses ) ;
16501654
16511655 return response . addresses ;
You can’t perform that action at this time.
0 commit comments