diff options
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r-- | packages/0x.js/test/order_validation_test.ts | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/0x.js/test/order_validation_test.ts index c894774b8..9b843b930 100644 --- a/packages/0x.js/test/order_validation_test.ts +++ b/packages/0x.js/test/order_validation_test.ts @@ -68,6 +68,40 @@ describe('OrderValidation', () => { ); await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); + it('should succeed if the maker is buying ZRX and has no ZRX balance', async () => { + const makerFee = new BigNumber(2); + const takerFee = new BigNumber(2); + const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( + makerTokenAddress, + zrxTokenAddress, + makerFee, + takerFee, + makerAddress, + takerAddress, + fillableAmount, + feeRecipient, + ); + const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + }); + it('should succeed if the maker is buying ZRX and has no ZRX balance and there is no specified taker', async () => { + const makerFee = new BigNumber(2); + const takerFee = new BigNumber(2); + const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( + makerTokenAddress, + zrxTokenAddress, + makerFee, + takerFee, + makerAddress, + constants.NULL_ADDRESS, + fillableAmount, + feeRecipient, + ); + const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + }); it('should succeed if the order is asymmetric and fillable', async () => { const makerFillableAmount = fillableAmount; const takerFillableAmount = fillableAmount.minus(4); @@ -469,4 +503,4 @@ describe('OrderValidation', () => { expect(partialTakerFee).to.be.bignumber.equal(takerPartialFee); }); }); -}); +}); // tslint:disable-line:max-file-line-count |