diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 07:36:11 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 07:36:11 +0800 |
commit | e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a (patch) | |
tree | 84929c7ae4e95896dacfb69517aaaba97ec8ad85 /packages/contracts/test/exchange/dispatcher.ts | |
parent | a97d77064aacda3de74b04894f110b05298c5ca8 (diff) | |
parent | 785b9811f30869f01242ce9ff81c282bf7f5352f (diff) | |
download | dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.gz dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.zst dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.zip |
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting
Diffstat (limited to 'packages/contracts/test/exchange/dispatcher.ts')
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index dc7b8a648..7804a2db9 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -9,6 +9,7 @@ import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c2 import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy'; import { TestAssetProxyDispatcherContract } from '../../src/contract_wrappers/generated/test_asset_proxy_dispatcher'; import { artifacts } from '../../src/utils/artifacts'; +import { expectRevertOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; @@ -174,14 +175,14 @@ describe('AssetProxyDispatcher', () => { const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20); expect(proxyAddress).to.be.equal(erc20Proxy.address); // The following transaction will throw because the currentAddress is no longer constants.NULL_ADDRESS - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, constants.NULL_ADDRESS, { from: owner }, ), - ).to.be.rejectedWith(constants.REVERT); + ); }); it('should be able to reset proxy address to NULL', async () => { @@ -215,26 +216,26 @@ describe('AssetProxyDispatcher', () => { it('should throw if requesting address is not owner', async () => { const prevProxyAddress = constants.NULL_ADDRESS; - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, prevProxyAddress, { from: notOwner }, ), - ).to.be.rejectedWith(constants.REVERT); + ); }); it('should throw if attempting to register a proxy to the incorrect id', async () => { const prevProxyAddress = constants.NULL_ADDRESS; - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, erc20Proxy.address, prevProxyAddress, { from: owner }, ), - ).to.be.rejectedWith(constants.REVERT); + ); }); }); @@ -303,7 +304,7 @@ describe('AssetProxyDispatcher', () => { const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(10); - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, @@ -311,7 +312,7 @@ describe('AssetProxyDispatcher', () => { amount, { from: owner }, ), - ).to.be.rejectedWith(constants.REVERT); + ); }); }); }); |