aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/dispatcher.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-25 18:32:16 +0800
committerFabio Berger <me@fabioberger.com>2018-06-25 18:32:16 +0800
commitc50da5d0344cd23392f71d213fff9dfec7ec71c9 (patch)
tree067e106202a83c0cd3bc929a940145100293f2b1 /packages/contracts/test/exchange/dispatcher.ts
parent9b196ba68c9f958cd82ef99ae87fdd87c70441a9 (diff)
parentdf79fb19aff1aa1ed7b1346feccfa3d235c25ea0 (diff)
downloaddexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.gz
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.bz2
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.lz
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.xz
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.zst
dexon-sol-tools-c50da5d0344cd23392f71d213fff9dfec7ec71c9.zip
merge check-revert-reasons
Diffstat (limited to 'packages/contracts/test/exchange/dispatcher.ts')
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index 0e2b82f19..d0c193bd2 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -9,11 +9,12 @@ import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c2
import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy';
import { TestAssetProxyDispatcherContract } from '../../src/generated_contract_wrappers/test_asset_proxy_dispatcher';
import { artifacts } from '../../src/utils/artifacts';
-import { expectRevertOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions';
+import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions';
import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
import { ERC721Wrapper } from '../../src/utils/erc721_wrapper';
+import { RevertReasons } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -178,13 +179,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 expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
constants.NULL_ADDRESS,
{ from: owner },
),
+ RevertReasons.AssetProxyMismatch,
);
});
@@ -219,25 +221,27 @@ describe('AssetProxyDispatcher', () => {
it('should throw if requesting address is not owner', async () => {
const prevProxyAddress = constants.NULL_ADDRESS;
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
prevProxyAddress,
{ from: notOwner },
),
+ RevertReasons.OnlyContractOwner,
);
});
it('should throw if attempting to register a proxy to the incorrect id', async () => {
const prevProxyAddress = constants.NULL_ADDRESS;
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
erc20Proxy.address,
prevProxyAddress,
{ from: owner },
),
+ RevertReasons.AssetProxyIdMismatch,
);
});
});
@@ -310,7 +314,7 @@ describe('AssetProxyDispatcher', () => {
const encodedAssetDataWithoutProxyId = encodedAssetData.slice(0, -2);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
encodedAssetDataWithoutProxyId,
AssetProxyId.ERC20,
@@ -319,6 +323,7 @@ describe('AssetProxyDispatcher', () => {
amount,
{ from: owner },
),
+ RevertReasons.AssetProxyDoesNotExist,
);
});
});