jest.mock('../../src/config/networks', () => { return { networks: { arbitrum: { chainId: 42161, QuoterV2: { address: '0x1' } }, polygon: { chainId: 137, QuoterV2: { address: '0x2' } }, broken: { QuoterV2: { address: '0x3' } }, }, }; }); import { getAvailableNetworks, getNetworkConfig, hasNetwork, } from '../../src/helpers/NetworkConfig'; describe('NetworkConfig behavior', () => { it('returns network config by name', () => { const config = getNetworkConfig('arbitrum' as any); expect(config.chainId).toBe(42161); }); it('looks up by exact name', () => { const config = getNetworkConfig('polygon' as any); expect(config.chainId).toBe(137); }); it('throws when network is missing', () => { expect(() => getNetworkConfig('missing' as any)).toThrow('not found'); }); it('throws when chainId is missing', () => { expect(() => getNetworkConfig('broken' as any)).toThrow('chainId'); }); it('lists available networks', () => { expect(getAvailableNetworks()).toEqual( expect.arrayContaining(['arbitrum', 'polygon', 'broken']), ); }); it('checks network existence', () => { expect(hasNetwork('arbitrum' as any)).toBe(true); expect(hasNetwork('unknown' as any)).toBe(false); }); });