Ran prettier and linter

This commit is contained in:
Lawrence Forman
2019-04-05 01:00:36 -04:00
committed by Amir Bandeali
parent 20d8c1b51a
commit 233336ea16
7 changed files with 28 additions and 68 deletions

View File

@@ -286,7 +286,7 @@ describe('AssetProxyDispatcher', () => {
amount,
{ from: owner },
);
expect(tx).to.revertWith(expectedError);
return expect(tx).to.revertWith(expectedError);
});
});
});

View File

@@ -587,11 +587,7 @@ describe('matchOrders', () => {
await reentrantErc20Token.setReentrantFunction.sendTransactionAsync(functionId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const tx = exchangeWrapper.matchOrdersAsync(
signedOrderLeft,
signedOrderRight,
takerAddress,
);
const tx = exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress);
return expect(tx).to.revertWith(RevertReason.ReentrancyIllegal);
});
});

View File

@@ -9,13 +9,8 @@ import {
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import {
assetDataUtils,
ExchangeRevertErrors,
orderHashUtils,
signatureUtils
} from '@0x/order-utils';
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
import { assetDataUtils, ExchangeRevertErrors, orderHashUtils, signatureUtils } from '@0x/order-utils';
import { SignatureType, SignedOrder } from '@0x/types';
import { BigNumber, providerUtils } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
@@ -408,11 +403,7 @@ describe('MixinSignatureValidator', () => {
orderHashHex,
ExchangeRevertErrors.SignatureErrorCode.ValidatorError,
);
const tx = signatureValidator.publicIsValidSignature.callAsync(
orderHashHex,
signerAddress,
signatureHex,
);
const tx = signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex);
return expect(tx).to.revertWith(expectedError);
});
it('should return false when SignatureType=Validator, signature is valid and validator is not approved', async () => {

View File

@@ -237,10 +237,7 @@ describe('Exchange transactions', () => {
it('should cancel the order when signed by maker and called by sender', async () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const expectedError = new ExchangeRevertErrors.OrderStatusError(
orderHashHex,
OrderStatus.Cancelled,
);
const expectedError = new ExchangeRevertErrors.OrderStatusError(orderHashHex, OrderStatus.Cancelled);
const tx = exchangeWrapper.fillOrderAsync(signedOrder, senderAddress);
return expect(tx).to.revertWith(expectedError);
});

View File

@@ -946,10 +946,7 @@ function validationErrorToRevertError(order: Order, reason: RevertReason): Rever
case RevertReason.OrderUnfillable:
return new ExchangeRevertErrors.OrderStatusError(orderHash);
case RevertReason.InvalidTakerAmount:
return new ExchangeRevertErrors.FillError(
orderHash,
ExchangeRevertErrors.FillErrorCode.InvalidTakerAmount,
);
return new ExchangeRevertErrors.FillError(orderHash, ExchangeRevertErrors.FillErrorCode.InvalidTakerAmount);
case RevertReason.TakerOverpay:
return new ExchangeRevertErrors.FillError(orderHash, ExchangeRevertErrors.FillErrorCode.TakerOverpay);
case RevertReason.OrderOverfill:

View File

@@ -207,10 +207,7 @@ describe('Exchange wrappers', () => {
expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
});
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const expectedError = new ExchangeRevertErrors.OrderStatusError(
orderHashHex,
OrderStatus.Expired,
);
const expectedError = new ExchangeRevertErrors.OrderStatusError(orderHashHex, OrderStatus.Expired);
const tx = exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress);
return expect(tx).to.revertWith(expectedError);
});
@@ -223,9 +220,7 @@ describe('Exchange wrappers', () => {
});
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
const expectedError = new ExchangeRevertErrors.IncompleteFillError(
orderHashHex,
);
const expectedError = new ExchangeRevertErrors.IncompleteFillError(orderHashHex);
const tx = exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress);
return expect(tx).to.revertWith(expectedError);
});
@@ -592,15 +587,10 @@ describe('Exchange wrappers', () => {
await exchangeWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrders[0]);
const expectedError = new ExchangeRevertErrors.OrderStatusError(
orderHashHex,
OrderStatus.FullyFilled,
);
const tx = exchangeWrapper.batchFillOrKillOrdersAsync(
signedOrders,
takerAddress,
{ takerAssetFillAmounts },
);
const expectedError = new ExchangeRevertErrors.OrderStatusError(orderHashHex, OrderStatus.FullyFilled);
const tx = exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
takerAssetFillAmounts,
});
return expect(tx).to.revertWith(expectedError);
});
});
@@ -749,11 +739,9 @@ describe('Exchange wrappers', () => {
await reentrantErc20Token.setReentrantFunction.sendTransactionAsync(functionId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const tx = exchangeWrapper.marketSellOrdersAsync(
[signedOrder],
takerAddress,
{ takerAssetFillAmount: signedOrder.takerAssetAmount},
);
const tx = exchangeWrapper.marketSellOrdersAsync([signedOrder], takerAddress, {
takerAssetFillAmount: signedOrder.takerAssetAmount,
});
return expect(tx).to.revertWith(RevertReason.ReentrancyIllegal);
});
});
@@ -848,11 +836,9 @@ describe('Exchange wrappers', () => {
orderHashHex,
ExchangeRevertErrors.SignatureErrorCode.BadSignature,
);
const tx = exchangeWrapper.marketSellOrdersAsync(
signedOrders,
takerAddress,
{ takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18) },
);
const tx = exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
});
return expect(tx).to.revertWith(expectedError);
});
});
@@ -1016,11 +1002,9 @@ describe('Exchange wrappers', () => {
await reentrantErc20Token.setReentrantFunction.sendTransactionAsync(functionId),
constants.AWAIT_TRANSACTION_MINED_MS,
);
const tx = exchangeWrapper.marketBuyOrdersAsync(
[signedOrder],
takerAddress,
{ makerAssetFillAmount: signedOrder.makerAssetAmount },
);
const tx = exchangeWrapper.marketBuyOrdersAsync([signedOrder], takerAddress, {
makerAssetFillAmount: signedOrder.makerAssetAmount,
});
return expect(tx).to.revertWith(RevertReason.ReentrancyIllegal);
});
});
@@ -1115,11 +1099,9 @@ describe('Exchange wrappers', () => {
orderHashHex,
ExchangeRevertErrors.SignatureErrorCode.BadSignature,
);
const tx = exchangeWrapper.marketBuyOrdersAsync(
signedOrders,
takerAddress,
{ makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18) },
);
const tx = exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
});
return expect(tx).to.revertWith(expectedError);
});
});

View File

@@ -105,12 +105,9 @@ describe('Revert Validation ExchangeWrapper', () => {
makerTokenBalance,
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const tx = contractWrappers.exchange.fillOrderAsync(
signedOrder,
takerTokenFillAmount,
takerAddress,
{ shouldValidate: true },
);
const tx = contractWrappers.exchange.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress, {
shouldValidate: true,
});
return expect(tx).to.revertWith(RevertReason.TransferFailed);
});
});