22 * @jest -environment jsdom
33 */
44
5- import { renderHook , act , waitFor } from '@testing-library/react' ;
6- import { useChain } from '../../src/hooks/useChain' ;
7- import { useWalletManager } from '../../src/hooks/useWalletManager' ;
85import { ChainNameNotExist , WalletState } from '@interchain-kit/core' ;
6+ import { ChainWalletState , InterchainStore , WalletManagerStore } from '@interchain-kit/store' ;
7+ import { WalletStore } from '@interchain-kit/store' ;
8+ import { act , renderHook , waitFor } from '@testing-library/react' ;
99
10- import { MockWallet } from '../helpers/mock-wallet' ;
1110import { useWalletModal } from '../../src/hooks' ;
12- import { WalletManagerStore , ChainWalletState , InterchainStore } from '@interchain-kit/store' ;
13- import { WalletStore } from '@interchain-kit/store' ;
11+ import { useChain } from '../../src/hooks/useChain' ;
12+ import { useWalletManager } from '../../src/hooks/useWalletManager' ;
13+ import { MockWallet } from '../helpers/mock-wallet' ;
1414
1515jest . mock ( '../../src/hooks/useWalletManager' ) ;
1616jest . mock ( '../../src/hooks/useWalletModal.ts' ) ;
@@ -48,6 +48,7 @@ describe('useChain', () => {
4848 addAssetList : jest . fn ( ) ,
4949 getChainById : jest . fn ( ) ,
5050 getAssetListByChainId : jest . fn ( ) ,
51+ getWalletOfType : jest . fn ( ) ,
5152 } as jest . Mocked < WalletStore > ;
5253
5354
@@ -95,7 +96,7 @@ describe('useChain', () => {
9596 getSigningClient : jest . fn ( ) ,
9697 getEnv : jest . fn ( ) ,
9798 getDownloadLink : jest . fn ( ) ,
98- } as jest . Mocked < WalletManagerStore >
99+ } as jest . Mocked < WalletManagerStore > ;
99100
100101 const mockWalletModal = {
101102 open : jest . fn ( ) ,
@@ -139,7 +140,7 @@ describe('useChain', () => {
139140 expect ( result . current . username ) . toBe ( 'test-user' ) ;
140141 expect ( result . current . address ) . toBe ( 'test-address' ) ;
141142 expect ( result . current . rpcEndpoint ) . toBe ( 'http://localhost:26657' ) ;
142- } )
143+ } ) ;
143144
144145
145146 } ) ;
@@ -157,7 +158,7 @@ describe('useChain', () => {
157158 await waitFor ( ( ) => {
158159 expect ( mockWalletManager . setCurrentChainName ) . toHaveBeenCalledWith ( 'test-chain' ) ;
159160 expect ( mockWalletModal . open ) . toHaveBeenCalled ( ) ;
160- } )
161+ } ) ;
161162 } ) ;
162163
163164 it ( 'should call disconnect when disconnect is invoked' , async ( ) => {
@@ -173,7 +174,7 @@ describe('useChain', () => {
173174 await waitFor ( ( ) => {
174175
175176 expect ( mockWalletManager . disconnect ) . toHaveBeenCalledWith ( 'test-wallet' , 'test-chain' ) ;
176- } )
177+ } ) ;
177178
178179 } ) ;
179180
@@ -190,7 +191,7 @@ describe('useChain', () => {
190191 await waitFor ( ( ) => {
191192 expect ( mockWalletManager . setCurrentChainName ) . toHaveBeenCalledWith ( 'test-chain' ) ;
192193 expect ( mockWalletModal . open ) . toHaveBeenCalled ( ) ;
193- } )
194+ } ) ;
194195
195196 } ) ;
196197
@@ -206,6 +207,6 @@ describe('useChain', () => {
206207
207208 await waitFor ( ( ) => {
208209 expect ( mockWalletModal . close ) . toHaveBeenCalled ( ) ;
209- } )
210+ } ) ;
210211 } ) ;
211212} ) ;
0 commit comments