aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-09-26 18:39:17 +0800
committerFabio Berger <me@fabioberger.com>2017-09-26 18:39:17 +0800
commite704aea64379e95edc4e40e7b280d6997ada3e4a (patch)
tree463e43032496b8aa0f672f962d6dad32a381e56e /test
parent25116940c0f3df4431e16d050da9b5d4f301b9d8 (diff)
downloaddexon-0x-contracts-e704aea64379e95edc4e40e7b280d6997ada3e4a.tar.gz
dexon-0x-contracts-e704aea64379e95edc4e40e7b280d6997ada3e4a.tar.zst
dexon-0x-contracts-e704aea64379e95edc4e40e7b280d6997ada3e4a.zip
Add tests for validateOrderFillableOrThrowAsync
Diffstat (limited to 'test')
-rw-r--r--test/order_validation_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/order_validation_test.ts b/test/order_validation_test.ts
index 9a621555c..4748ec5a5 100644
--- a/test/order_validation_test.ts
+++ b/test/order_validation_test.ts
@@ -54,6 +54,27 @@ describe('OrderValidation', () => {
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
+ describe('validateOrderFillableOrThrowAsync', () => {
+ it('should throw when the order is fully filled or cancelled', async () => {
+ const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
+ );
+ await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
+ return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(
+ signedOrder,
+ )).to.be.rejectedWith(ExchangeContractErrs.OrderRemainingFillAmountZero);
+ });
+ it('should throw when order is expired', async () => {
+ const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
+ const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
+ fillableAmount, expirationInPast,
+ );
+ return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(
+ signedOrder,
+ )).to.be.rejectedWith(ExchangeContractErrs.OrderFillExpired);
+ });
+ });
describe('validateFillOrderAndThrowIfInvalidAsync', () => {
it('should throw when the fill amount is zero', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(