aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/transactions.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-06-07 04:43:29 +0800
committerGitHub <noreply@github.com>2018-06-07 04:43:29 +0800
commit785b9811f30869f01242ce9ff81c282bf7f5352f (patch)
treefe1615f0db90f76627bfb88874c19634321105bc /packages/contracts/test/exchange/transactions.ts
parentda3f783a9ff69b059b1a98f502d980660d6bacab (diff)
parent643c77ded08d3082aff7ae47063d40c9c1fdb677 (diff)
downloaddexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.gz
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.bz2
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.lz
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.xz
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.zst
dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.zip
Merge pull request #622 from 0xProject/geth-devnet-rebase-on-v2
Run contract tests against private Geth network
Diffstat (limited to 'packages/contracts/test/exchange/transactions.ts')
-rw-r--r--packages/contracts/test/exchange/transactions.ts25
1 files changed, 13 insertions, 12 deletions
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index f31053ad3..e64cb68f5 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -11,6 +11,7 @@ import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c2
import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange';
import { WhitelistContract } from '../../src/contract_wrappers/generated/whitelist';
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';
@@ -126,8 +127,8 @@ describe('Exchange transactions', () => {
});
it('should throw if not called by specified sender', async () => {
- return expect(exchangeWrapper.executeTransactionAsync(signedTx, takerAddress)).to.be.rejectedWith(
- constants.REVERT,
+ return expectRevertOrAlwaysFailingTransactionAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
);
});
@@ -168,8 +169,8 @@ describe('Exchange transactions', () => {
it('should throw if the a 0x transaction with the same transactionHash has already been executed', async () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- return expect(exchangeWrapper.executeTransactionAsync(signedTx, senderAddress)).to.be.rejectedWith(
- constants.REVERT,
+ return expectRevertOrAlwaysFailingTransactionAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
);
});
@@ -187,15 +188,15 @@ describe('Exchange transactions', () => {
});
it('should throw if not called by specified sender', async () => {
- return expect(exchangeWrapper.executeTransactionAsync(signedTx, makerAddress)).to.be.rejectedWith(
- constants.REVERT,
+ return expectRevertOrAlwaysFailingTransactionAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
);
});
it('should cancel the order when signed by maker and called by sender', async () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- return expect(exchangeWrapper.fillOrderAsync(signedOrder, senderAddress)).to.be.rejectedWith(
- constants.REVERT,
+ return expectRevertOrAlwaysFailingTransactionAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
);
});
});
@@ -244,7 +245,7 @@ describe('Exchange transactions', () => {
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
const takerAssetFillAmount = signedOrder.takerAssetAmount;
const salt = generatePseudoRandomSalt();
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
orderWithoutExchangeAddress,
takerAssetFillAmount,
@@ -252,7 +253,7 @@ describe('Exchange transactions', () => {
signedOrder.signature,
{ from: takerAddress },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should revert if taker has not been whitelisted', async () => {
@@ -264,7 +265,7 @@ describe('Exchange transactions', () => {
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
const takerAssetFillAmount = signedOrder.takerAssetAmount;
const salt = generatePseudoRandomSalt();
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
orderWithoutExchangeAddress,
takerAssetFillAmount,
@@ -272,7 +273,7 @@ describe('Exchange transactions', () => {
signedOrder.signature,
{ from: takerAddress },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should fill the order if maker and taker have been whitelisted', async () => {