fix: tests and only show error data if present

This commit is contained in:
Matthew Russell
2024-03-06 13:54:59 +00:00
parent cda3a5050e
commit d46af0009a
3 changed files with 4 additions and 4 deletions
@@ -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}` : ''}
</p>
)}
<a
+1 -2
View File
@@ -93,7 +93,6 @@ describe('disconnect', () => {
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,
});
});
+1 -1
View File
@@ -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;
}