import 'jest'; import config from '../config/config'; import { getTestConfig } from './utils'; const chainId = getTestConfig().chainId; describe('uninitialized config', () => { it('should return config', () => { expect(config).toBeDefined(); expect(config.getSystemData(chainId)).toEqual(undefined); }); it('should have undefined wallets', () => { expect(() => config.availableWallets).toThrow('No available wallets'); }); it('should throw error for not providing rpc', async () => { try { await config.initialize({ supportedChains: [chainId], moralisApiKey: '', pinataJWTToken: '', providerRpcUrls: {}, }); } catch (e) { expect(String(e)).toMatch( 'No provider RPC URL for chain id ' + chainId ); } expect(config.getSystemData(chainId)).toEqual(undefined); }); it('should initialize config', async () => { await config.initialize({ supportedChains: [chainId], moralisApiKey: '', pinataJWTToken: '', providerRpcUrls: { [chainId]: getTestConfig().rpcUrl, }, }); expect(config.availableWallets).toHaveLength(1); const { contractFactory, diamondFacetsRegistry, collectionRegistry, omniteLayerZeroBridgeSender, omniteLayerZeroBridgeReceiver, } = config.getSystemData(chainId); expect(contractFactory).toHaveLength(42); expect(contractFactory).toContain('0x'); expect(diamondFacetsRegistry).toHaveLength(42); expect(diamondFacetsRegistry).toContain('0x'); expect(collectionRegistry).toHaveLength(42); expect(collectionRegistry).toContain('0x'); expect(omniteLayerZeroBridgeSender).toHaveLength(42); expect(omniteLayerZeroBridgeSender).toContain('0x'); expect(omniteLayerZeroBridgeReceiver).toHaveLength(42); expect(omniteLayerZeroBridgeReceiver).toContain('0x'); }); });