aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-24 02:18:31 +0800
committerGitHub <noreply@github.com>2018-03-24 02:18:31 +0800
commitf30353087f9c4ec4fa5e096a065c9749e1164984 (patch)
tree4d7968160890b5efa358593e743411c7b8652556 /packages/0x.js/test
parent7ef6bd4b14b7502617c6929010d4a9991e1d577d (diff)
parentbed7d87b7ff64989051e6b2115a1c77e1e72ff55 (diff)
downloaddexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar.gz
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar.bz2
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar.lz
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar.xz
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.tar.zst
dexon-sol-tools-f30353087f9c4ec4fa5e096a065c9749e1164984.zip
Merge branch 'development' into feature/deployer-improvements
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r--packages/0x.js/test/0x.js_test.ts6
-rw-r--r--packages/0x.js/test/ether_token_wrapper_test.ts2
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts13
3 files changed, 17 insertions, 4 deletions
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts
index d1f601c92..d61847d1d 100644
--- a/packages/0x.js/test/0x.js_test.ts
+++ b/packages/0x.js/test/0x.js_test.ts
@@ -41,11 +41,11 @@ describe('ZeroEx library', () => {
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined();
// Check that all nested web3 wrapper instances return the updated provider
- const nestedWeb3WrapperProvider = (zeroEx as any)._web3Wrapper.getCurrentProvider();
+ const nestedWeb3WrapperProvider = (zeroEx as any)._web3Wrapper.getProvider();
expect(nestedWeb3WrapperProvider.zeroExTestId).to.be.a('number');
- const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getCurrentProvider();
+ const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider();
expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number');
- const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getCurrentProvider();
+ const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getProvider();
expect(tokenRegistryWeb3WrapperProvider.zeroExTestId).to.be.a('number');
});
});
diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts
index da6d95d07..6237ccf23 100644
--- a/packages/0x.js/test/ether_token_wrapper_test.ts
+++ b/packages/0x.js/test/ether_token_wrapper_test.ts
@@ -137,7 +137,7 @@ describe('EtherTokenWrapper', () => {
gasCost = expectedETHBalance.minus(postETHBalance);
expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI);
});
- it('should throw if user has insufficient WETH balance for withdrawl', async () => {
+ it('should throw if user has insufficient WETH balance for withdrawal', async () => {
const preWETHBalance = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH);
expect(preWETHBalance).to.be.bignumber.equal(0);
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index 0a4ea608d..cfc390bae 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -596,6 +596,19 @@ describe('ExchangeWrapper', () => {
const remainingFillAmount = fillableAmount.minus(1);
expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount);
});
+ it('should successfully fill up to specified amount and leave the rest of the orders untouched', async () => {
+ const txHash = await zeroEx.exchange.fillOrdersUpToAsync(
+ signedOrders,
+ fillableAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ takerAddress,
+ );
+ await zeroEx.awaitTransactionMinedAsync(txHash);
+ const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
+ const zeroAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
+ expect(filledAmount).to.be.bignumber.equal(fillableAmount);
+ expect(zeroAmount).to.be.bignumber.equal(0);
+ });
it('should successfully fill up to specified amount even if filling all orders would fail', async () => {
const missingBalance = new BigNumber(1); // User will still have enough balance to fill up to 9,
// but won't have 10 to fully fill all orders in a batch.