aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/asset_proxy/proxies.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-07 07:36:11 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-07 07:36:11 +0800
commite0d5b9daf84cba31bbbcd2cfbe1f64623eace61a (patch)
tree84929c7ae4e95896dacfb69517aaaba97ec8ad85 /packages/contracts/test/asset_proxy/proxies.ts
parenta97d77064aacda3de74b04894f110b05298c5ca8 (diff)
parent785b9811f30869f01242ce9ff81c282bf7f5352f (diff)
downloaddexon-0x-contracts-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.gz
dexon-0x-contracts-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.zst
dexon-0x-contracts-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting
Diffstat (limited to 'packages/contracts/test/asset_proxy/proxies.ts')
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts33
1 files changed, 17 insertions, 16 deletions
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index b6284a81e..eb2a1544f 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -8,6 +8,7 @@ import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/d
import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token';
import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy';
import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy';
+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';
@@ -142,7 +143,7 @@ describe('Asset Transfer Proxies', () => {
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Perform a transfer; expect this to fail.
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -150,7 +151,7 @@ describe('Asset Transfer Proxies', () => {
transferAmount,
{ from: notAuthorized },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should throw if requesting address is not authorized', async () => {
@@ -158,7 +159,7 @@ describe('Asset Transfer Proxies', () => {
const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -168,7 +169,7 @@ describe('Asset Transfer Proxies', () => {
from: notAuthorized,
},
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
});
@@ -215,7 +216,7 @@ describe('Asset Transfer Proxies', () => {
const toAddresses = _.times(numTransfers, () => takerAddress);
const amounts = _.times(numTransfers, () => amount);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.batchTransferFrom.sendTransactionAsync(
assetMetadata,
fromAddresses,
@@ -223,7 +224,7 @@ describe('Asset Transfer Proxies', () => {
amounts,
{ from: notAuthorized },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
});
@@ -272,7 +273,7 @@ describe('Asset Transfer Proxies', () => {
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(0);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -280,7 +281,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: exchangeAddress },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should throw if transferring > 1 amount of a token', async () => {
@@ -294,7 +295,7 @@ describe('Asset Transfer Proxies', () => {
expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(500);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -302,7 +303,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: exchangeAddress },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should throw if allowances are too low', async () => {
@@ -320,7 +321,7 @@ describe('Asset Transfer Proxies', () => {
);
// Perform a transfer; expect this to fail.
const amount = new BigNumber(1);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc20Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -330,7 +331,7 @@ describe('Asset Transfer Proxies', () => {
from: notAuthorized,
},
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should throw if requesting address is not authorized', async () => {
@@ -341,7 +342,7 @@ describe('Asset Transfer Proxies', () => {
);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(1);
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.transferFrom.sendTransactionAsync(
encodedProxyMetadata,
makerAddress,
@@ -349,7 +350,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: notAuthorized },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
});
@@ -399,7 +400,7 @@ describe('Asset Transfer Proxies', () => {
const toAddresses = _.times(numTransfers, () => takerAddress);
const amounts = _.times(numTransfers, () => new BigNumber(1));
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
erc721Proxy.batchTransferFrom.sendTransactionAsync(
assetMetadata,
fromAddresses,
@@ -407,7 +408,7 @@ describe('Asset Transfer Proxies', () => {
amounts,
{ from: notAuthorized },
),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
});