Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting

This commit is contained in:
fragosti
2018-06-06 16:36:11 -07:00
61 changed files with 1024 additions and 293 deletions

View File

@@ -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);
);
});
});