Skip to content

Commit 44ebea9

Browse files
committed
test: for wallet/chain state sync
1 parent 0a4e41e commit 44ebea9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

packages/store/__tests__/interchain-store.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,30 @@ describe('InterchainStore', () => {
238238
expect(osmosisKeplr).toBeUndefined();
239239
});
240240
});
241+
242+
describe('Current Wallet/Chain Auto-Sync', () => {
243+
it('should set currentWalletName and currentChainName when connected', () => {
244+
store.updateChainWalletState('keplr', 'cosmoshub', {
245+
walletState: WalletState.Connected,
246+
});
247+
248+
const state = store.getState();
249+
expect(state.currentWalletName).toBe('keplr');
250+
expect(state.currentChainName).toBe('cosmoshub');
251+
});
252+
253+
it('should clear current when disconnecting the current wallet/chain', () => {
254+
store.updateChainWalletState('keplr', 'cosmoshub', {
255+
walletState: WalletState.Connected,
256+
});
257+
258+
store.updateChainWalletState('keplr', 'cosmoshub', {
259+
walletState: WalletState.Disconnected,
260+
});
261+
262+
const state = store.getState();
263+
expect(state.currentWalletName).toBe('');
264+
expect(state.currentChainName).toBe('');
265+
});
266+
});
241267
});

0 commit comments

Comments
 (0)