From d46af0009a95eb6d32af9c0dcdf79d8dfea3b725 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 6 Mar 2024 13:54:59 +0000 Subject: [PATCH] fix: tests and only show error data if present --- .../src/components/connect-dialog/connection-options.tsx | 3 ++- libs/wallet/src/wallet.spec.ts | 3 +-- libs/wallet/src/wallet.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/wallet-react/src/components/connect-dialog/connection-options.tsx b/libs/wallet-react/src/components/connect-dialog/connection-options.tsx index b0a6fe0a4..45a2fa71f 100644 --- a/libs/wallet-react/src/components/connect-dialog/connection-options.tsx +++ b/libs/wallet-react/src/components/connect-dialog/connection-options.tsx @@ -69,7 +69,8 @@ export const ConnectionOptions = ({ className="text-danger text-sm first-letter:uppercase" data-testid="connection-error" > - {error.message}: {error.data} + {error.message} + {error.data ? `: ${error.data}` : ''}

)} { expect(result).toEqual({ status: 'disconnected' }); expect(config.store.getState()).toMatchObject({ status: 'disconnected', - error: noConnectorError(), current: undefined, keys: [], pubKey: undefined, @@ -130,7 +129,7 @@ describe('refresh keys', () => { it('handles invalid connector', async () => { await config.refreshKeys(); expect(config.store.getState()).toMatchObject({ - error: noConnectorError(), + error: undefined, }); }); diff --git a/libs/wallet/src/wallet.ts b/libs/wallet/src/wallet.ts index af8a0b037..cc287e77c 100644 --- a/libs/wallet/src/wallet.ts +++ b/libs/wallet/src/wallet.ts @@ -143,7 +143,7 @@ export function createConfig(cfg: Config): Wallet { // Only refresh keys if connnected. If you aren't connect when you connect // you will get the latest keys - if (state.status === 'connected') { + if (state.status !== 'connected') { return; }