Check revert reason in dispatcher tests
This commit is contained in:
@@ -549,8 +549,9 @@ describe('Exchange core', () => {
|
||||
});
|
||||
|
||||
it('should throw if not sent by maker', async () => {
|
||||
return expectRevertOrAlwaysFailingTransactionAsync(
|
||||
return expectRevertReasonOrAlwaysFailingTransactionAsync(
|
||||
exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
|
||||
ContractLibErrors.InvalidMaker,
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -9,11 +9,15 @@ 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 {
|
||||
expectRevertOrAlwaysFailingTransactionAsync,
|
||||
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 { ContractLibErrors } from '../../src/utils/types';
|
||||
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
@@ -175,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 },
|
||||
),
|
||||
ContractLibErrors.AssetProxyMismatch,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -216,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 },
|
||||
),
|
||||
ContractLibErrors.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 },
|
||||
),
|
||||
ContractLibErrors.AssetProxyIdMismatch,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user