aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-16 18:22:04 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-16 18:22:04 +0800
commit89d6326a83afc386d7d388776ab0a419ece20739 (patch)
treef2c550a3cb85e441737ae0ce7962117c288997d9 /packages/0x.js/test
parent8b81ea162fd32df0dc2dcbdbc47be0e1bb09ea0f (diff)
downloaddexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar.gz
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar.bz2
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar.lz
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar.xz
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.tar.zst
dexon-sol-tools-89d6326a83afc386d7d388776ab0a419ece20739.zip
Fix fillOrdersUpTo balances validation
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index 32f8514d9..3e4c40b15 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -568,6 +568,20 @@ describe('ExchangeWrapper', () => {
expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount);
});
});
+ describe('failed batch fills', () => {
+ it("should fail validation if user doesn't have enough balance wo fill up to", async () => {
+ const missingBalance = new BigNumber(2); // User will only have anough balance to fill up to 8
+ await zeroEx.token.transferAsync(makerTokenAddress, makerAddress, coinbase, missingBalance);
+ return expect(
+ zeroEx.exchange.fillOrdersUpToAsync(
+ signedOrders,
+ fillUpToAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ takerAddress,
+ ),
+ ).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance);
+ });
+ });
describe('order transaction options', () => {
const emptyFillUpToAmount = new BigNumber(0);
it('should validate when orderTransactionOptions are not present', async () => {