aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-09-28 23:44:29 +0800
committerBrandon Millman <brandon.millman@gmail.com>2017-09-28 23:44:29 +0800
commitd21fbbc4c83cd7dd434f7e8389d48ed35fe0a5b0 (patch)
treebee5d0b011d5d8686711fe8da0bf7553305db3ab /test
parent333665370fda26753e137f5b11464493b7d5880c (diff)
downloaddexon-0x-contracts-d21fbbc4c83cd7dd434f7e8389d48ed35fe0a5b0.tar.gz
dexon-0x-contracts-d21fbbc4c83cd7dd434f7e8389d48ed35fe0a5b0.tar.zst
dexon-0x-contracts-d21fbbc4c83cd7dd434f7e8389d48ed35fe0a5b0.zip
Fixed nits
Diffstat (limited to 'test')
-rw-r--r--test/exchange_wrapper_test.ts107
1 files changed, 41 insertions, 66 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index ec0a05a76..45a2d3907 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -114,18 +114,14 @@ describe('ExchangeWrapper', () => {
.to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should validate when orderTransactionOptions specify to validate', async () => {
- return expect(zeroEx.exchange.batchFillOrKillAsync(orderFillOrKillRequests, takerAddress,
- {
- shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ return expect(zeroEx.exchange.batchFillOrKillAsync(orderFillOrKillRequests, takerAddress, {
+ shouldValidate: true,
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
- return expect(zeroEx.exchange.batchFillOrKillAsync(orderFillOrKillRequests, takerAddress,
- {
- shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ return expect(zeroEx.exchange.batchFillOrKillAsync(orderFillOrKillRequests, takerAddress, {
+ shouldValidate: false,
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
});
});
@@ -177,18 +173,14 @@ describe('ExchangeWrapper', () => {
.to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should validate when orderTransactionOptions specify to validate', async () => {
- return expect(zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress,
- {
- shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ return expect(zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, {
+ shouldValidate: true,
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
- return expect(zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress,
- {
- shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ return expect(zeroEx.exchange.fillOrKillOrderAsync(signedOrder, emptyFillableAmount, takerAddress, {
+ shouldValidate: false,
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
});
});
@@ -277,22 +269,20 @@ describe('ExchangeWrapper', () => {
});
it('should validate when orderTransactionOptions are not present', async () => {
return expect(zeroEx.exchange.fillOrderAsync(
- signedOrder, emptyFillTakerAmount, false, takerAddress,
+ signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
)).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should validate when orderTransactionOptions specify to validate', async () => {
- return expect(zeroEx.exchange.fillOrderAsync(signedOrder, emptyFillTakerAmount, false, takerAddress,
- {
+ return expect(zeroEx.exchange.fillOrderAsync(
+ signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
- return expect(zeroEx.exchange.fillOrderAsync(signedOrder, emptyFillTakerAmount, false, takerAddress,
- {
+ return expect(zeroEx.exchange.fillOrderAsync(
+ signedOrder, emptyFillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
});
});
@@ -361,19 +351,15 @@ describe('ExchangeWrapper', () => {
});
it('should validate when orderTransactionOptions specify to validate', async () => {
return expect(zeroEx.exchange.batchFillOrdersAsync(
- orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- {
+ orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
return expect(zeroEx.exchange.batchFillOrdersAsync(
- orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- {
+ orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
});
});
@@ -422,19 +408,15 @@ describe('ExchangeWrapper', () => {
});
it('should validate when orderTransactionOptions specify to validate', async () => {
return expect(zeroEx.exchange.fillOrdersUpToAsync(
- signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- {
+ signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
return expect(zeroEx.exchange.fillOrdersUpToAsync(
- signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
- {
+ signedOrders, emptyFillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, {
shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
});
});
@@ -469,23 +451,20 @@ describe('ExchangeWrapper', () => {
});
});
describe('order transaction options', () => {
+ const emptyCancelTakerTokenAmount = new BigNumber(0);
it('should validate when orderTransactionOptions are not present', async () => {
- return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, new BigNumber(0)))
+ return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount))
.to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should validate when orderTransactionOptions specify to validate', async () => {
- return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, new BigNumber(0),
- {
- shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
+ return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, {
+ shouldValidate: true,
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
- return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, new BigNumber(0),
- {
- shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
+ return expect(zeroEx.exchange.cancelOrderAsync(signedOrder, emptyCancelTakerTokenAmount, {
+ shouldValidate: false,
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
});
});
@@ -553,18 +532,14 @@ describe('ExchangeWrapper', () => {
.to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should validate when orderTransactionOptions specify to validate', async () => {
- return expect(zeroEx.exchange.batchCancelOrdersAsync(cancelBatch,
- {
- shouldValidate: true,
- },
- )).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
+ return expect(zeroEx.exchange.batchCancelOrdersAsync(cancelBatch, {
+ shouldValidate: true,
+ })).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should not validate when orderTransactionOptions specify not to validate', async () => {
- return expect(zeroEx.exchange.batchCancelOrdersAsync(cancelBatch,
- {
- shouldValidate: false,
- },
- )).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
+ return expect(zeroEx.exchange.batchCancelOrdersAsync(cancelBatch, {
+ shouldValidate: false,
+ })).to.not.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
});
});