Make tokenRegistry contract instantiation lazy and clear it on provider update

This commit is contained in:
Fabio Berger
2017-05-30 12:43:50 +02:00
parent cb31b21d28
commit a3ce892f85
3 changed files with 17 additions and 5 deletions

View File

@@ -26,8 +26,9 @@ describe('ZeroEx library', () => {
(newProvider as any).zeroExTestId = 1;
zeroEx.setProvider(newProvider);
// Check that exchangeContract instance removed after provider update
// Check that contractInstances with old provider are removed after provider update
expect((zeroEx.exchange as any).exchangeContractIfExists).to.be.an('undefined');
expect((zeroEx.tokenRegistry as any).tokenRegistryContractIfExists).to.be.an('undefined');
// Check that all nested web3 instances return the updated provider
const nestedWeb3WrapperProvider = (zeroEx as any).web3Wrapper.getCurrentProvider();