From 400a97e7a8f76d894d47368425bbe1e33fa5b255 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Feb 2018 12:32:59 +0100 Subject: Add regression tests --- packages/0x.js/test/ether_token_wrapper_test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts index 98e6981fd..145f11bd1 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/0x.js/test/ether_token_wrapper_test.ts @@ -71,6 +71,18 @@ describe('EtherTokenWrapper', () => { afterEach(async () => { await blockchainLifecycle.revertAsync(); }); + describe('#getContractAddressIfExists', async () => { + it('should return contract address if connected to a known network', () => { + const contractAddressIfExists = zeroEx.etherToken.getContractAddressIfExists(); + expect(contractAddressIfExists).to.not.be.undefined(); + }); + it('should return undefined if connected to an unknown network', () => { + const UNKNOWN_NETWORK_NETWORK_ID = 10; + const unknownNetworkZeroEx = new ZeroEx(web3.currentProvider, { networkId: UNKNOWN_NETWORK_NETWORK_ID }); + const contractAddressIfExists = unknownNetworkZeroEx.etherToken.getContractAddressIfExists(); + expect(contractAddressIfExists).to.be.undefined(); + }); + }); describe('#depositAsync', () => { it('should successfully deposit ETH and issue Wrapped ETH tokens', async () => { const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); -- cgit v1.2.3