mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
aabcd3f7a3
* Set default unit to 'ETH' instead of 'ether' * Use 'isEtherUnit()' everywhere * Set default unit to empty string * Update isEthUnit to isNetworkUnit * Fix unit conversion for non-ethereum networks * Set default network unit properly * Fix tests * fix typos * Update isNetworkUnit selector * Update isNetworkUnit * Fix validationhelpers tests * Add mock state to tests & Move isNetworkUnit to selectors * Fix validation helper spec * fix unit swap spec
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { configuredStore } from 'store';
|
|
import CONTRACTS from 'config/contracts';
|
|
import { isValidETHAddress } from 'libs/validators';
|
|
configuredStore.getState();
|
|
|
|
describe('Contracts JSON', () => {
|
|
Object.keys(CONTRACTS).forEach(network => {
|
|
it(`${network} contracts array properly formatted`, () => {
|
|
const contracts = CONTRACTS[network];
|
|
const addressCollisionMap = {};
|
|
|
|
contracts.forEach(contract => {
|
|
if (contract.address && !isValidETHAddress(contract.address)) {
|
|
throw Error(`Contract '${contract.name}' has invalid address '${contract.address}'`);
|
|
}
|
|
if (addressCollisionMap[contract.address]) {
|
|
throw Error(
|
|
`Contract '${contract.name}' has the same address as ${
|
|
addressCollisionMap[contract.address]
|
|
}`
|
|
);
|
|
}
|
|
|
|
try {
|
|
JSON.stringify(contract.abi);
|
|
} catch (err) {
|
|
throw Error(`Contract '${contract.name}' has invalid JSON ABI`);
|
|
}
|
|
|
|
addressCollisionMap[contract.address] = contract.name;
|
|
});
|
|
});
|
|
});
|
|
});
|