Skip to content

Commit

Permalink
fix: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
salimtb committed Oct 16, 2024
1 parent 03546d6 commit 2bb875d
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,32 @@ describe('NetworkSettings', () => {

expect(instance.state.warningSymbol).toBeUndefined(); // No warning for valid symbol
});

it('should validateChainIdOnSubmit', async () => {
const instance = wrapper.instance();

const validChainId = '0x38';

await instance.validateChainIdOnSubmit(
validChainId,
validChainId,
'https://bsc-dataseed.binance.org/',
);

expect(instance.state.warningChainId).toBeUndefined();
});

it('should set a warning when chainId is not valid', async () => {
const instance = wrapper.instance();

const validChainId = '0xInvalidChainId';

await instance.validateChainIdOnSubmit(validChainId);

expect(instance.state.warningChainId).toBe(
'Could not fetch chain ID. Is your RPC URL correct?',
);
});
});

describe('NetworkSettings componentDidMount', () => {
Expand Down

0 comments on commit 2bb875d

Please sign in to comment.