aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-23 03:53:37 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-25 06:39:19 +0800
commitfdea260e41111f3d27c05ab2d2523d2473c1ac05 (patch)
tree9152d653830781d4f7bdb8b78655dea30647fde0 /packages/contracts
parent9af77dc835b50d957c308d6de83d26b089ec6e43 (diff)
downloaddexon-0x-contracts-fdea260e41111f3d27c05ab2d2523d2473c1ac05.tar.gz
dexon-0x-contracts-fdea260e41111f3d27c05ab2d2523d2473c1ac05.tar.zst
dexon-0x-contracts-fdea260e41111f3d27c05ab2d2523d2473c1ac05.zip
Cleanup tests
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/utils/multi_sig_wrapper.ts2
-rw-r--r--packages/contracts/test/asset_proxy_owner.ts4
-rw-r--r--packages/contracts/test/exchange/core.ts4
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts8
4 files changed, 12 insertions, 6 deletions
diff --git a/packages/contracts/src/utils/multi_sig_wrapper.ts b/packages/contracts/src/utils/multi_sig_wrapper.ts
index 730cdcbef..3e6c96d84 100644
--- a/packages/contracts/src/utils/multi_sig_wrapper.ts
+++ b/packages/contracts/src/utils/multi_sig_wrapper.ts
@@ -50,7 +50,7 @@ export class MultiSigWrapper {
return tx;
}
private async _getTxWithDecodedMultiSigLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
- const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
+ const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
tx.logs = _.filter(tx.logs, log => log.address === this._multiSig.address);
tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log));
return tx;
diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts
index e3c6a5324..7a520d0ad 100644
--- a/packages/contracts/test/asset_proxy_owner.ts
+++ b/packages/contracts/test/asset_proxy_owner.ts
@@ -90,7 +90,7 @@ describe('AssetProxyOwner', () => {
});
it('should throw if a null address is included in assetProxyContracts', async () => {
const assetProxyContractAddresses = [erc20Proxy.address, ZeroEx.NULL_ADDRESS];
- expect(
+ return expect(
AssetProxyOwnerContract.deployFrom0xArtifactAsync(
artifacts.AssetProxyOwner,
provider,
@@ -128,7 +128,7 @@ describe('AssetProxyOwner', () => {
describe('registerAssetProxy', () => {
it('should throw if not called by multisig', async () => {
const isRegistered = true;
- expect(
+ return expect(
multiSig.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, isRegistered, { from: owners[0] }),
).to.be.rejectedWith(constants.REVERT);
});
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 84f25361c..29b19e920 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -703,7 +703,7 @@ describe('Exchange core', () => {
// Create 3 orders with makerEpoch values: 0,1,2,3
// Since we cancelled with makerEpoch=1, orders with makerEpoch<=1 will not be processed
erc20Balances = await erc20Wrapper.getBalancesAsync();
- const signedOrders = await Promise.all([
+ const signedOrders = [
orderFactory.newSignedOrder({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
@@ -724,7 +724,7 @@ describe('Exchange core', () => {
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
salt: new BigNumber(3),
}),
- ]);
+ ];
await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index fc28c363b..968bac300 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -250,8 +250,14 @@ describe('LibBytes', () => {
*/
describe('readFirst4', () => {
+ it('should revert if byte array has a length < 4', async () => {
+ const byteArrayLessThan4Bytes = '0x010101';
+ return expect(libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes)).to.be.rejectedWith(
+ constants.REVERT,
+ );
+ });
it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
- const first4Bytes = libBytes.publicReadFirst4.callAsync(byteArrayLongerThan32Bytes);
+ const first4Bytes = await libBytes.publicReadFirst4.callAsync(byteArrayLongerThan32Bytes);
const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10);
expect(first4Bytes).to.equal(expectedFirst4Bytes);
});