diff options
author | Fabio Berger <me@fabioberger.com> | 2017-09-26 21:27:59 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-09-26 21:27:59 +0800 |
commit | 5bea6ff581dddd03ff99da69688fe8fb9c467b82 (patch) | |
tree | bcc3f66f4b06739cda6ebd0907d7235f70eeba4f | |
parent | e704aea64379e95edc4e40e7b280d6997ada3e4a (diff) | |
download | dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar.gz dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar.bz2 dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar.lz dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar.xz dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.tar.zst dexon-sol-tools-5bea6ff581dddd03ff99da69688fe8fb9c467b82.zip |
Add success test and regression test for previous bug where comparing makerTokenAmount with a takerTokenAmount
-rw-r--r-- | test/order_validation_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/order_validation_test.ts b/test/order_validation_test.ts index 4748ec5a5..022a39dd1 100644 --- a/test/order_validation_test.ts +++ b/test/order_validation_test.ts @@ -55,6 +55,25 @@ describe('OrderValidation', () => { await blockchainLifecycle.revertAsync(); }); describe('validateOrderFillableOrThrowAsync', () => { + it('should succeed if the order is fillable', async () => { + const signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, + ); + await zeroEx.exchange.validateOrderFillableOrThrowAsync( + signedOrder, + ); + }); + it('should succeed if the order is asymmetric and fillable', async () => { + const makerFillableAmount = fillableAmount; + const takerFillableAmount = fillableAmount.minus(5000); + const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, + makerFillableAmount, takerFillableAmount, + ); + await zeroEx.exchange.validateOrderFillableOrThrowAsync( + signedOrder, + ); + }); it('should throw when the order is fully filled or cancelled', async () => { const signedOrder = await fillScenarios.createFillableSignedOrderAsync( makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, |