diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-11-15 01:29:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-11-15 01:29:46 +0800 |
commit | 9bb5e6f5ce199acde620a0fb8f36f585e1c763e9 (patch) | |
tree | 125f6d75b0e664208d5fef11694d9e982a932c45 /packages/0x.js/test | |
parent | 56b5619d24b44d23f770b58b0c9e1d4a63b89aca (diff) | |
parent | 05de07496fe3f9089b4c96b0594b234afc436304 (diff) | |
download | dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.gz dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.bz2 dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.lz dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.xz dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.zst dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.zip |
Merge branch 'development' into feature/addJsonSchemas
* development:
Improve description
Alphabetize
Add exit 0 to 0x.js build command
Add snapshot save and revert to order_state_watcher_test.ts
Fix changelog
Use tslint v5.8.0 everywhere and use the tslint-config sub-package instead of the old repo as a dep. in the rest of the sub-packages.
Add tslint-config sub-package
Fix tslint issue
Public interface has changed, moved to minor version
Update changelog
Renamed canceled to cancelled
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r-- | packages/0x.js/test/exchange_wrapper_test.ts | 16 | ||||
-rw-r--r-- | packages/0x.js/test/order_state_watcher_test.ts | 8 |
2 files changed, 15 insertions, 9 deletions
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts index 26b8c1e0e..add89a3b2 100644 --- a/packages/0x.js/test/exchange_wrapper_test.ts +++ b/packages/0x.js/test/exchange_wrapper_test.ts @@ -443,7 +443,7 @@ describe('ExchangeWrapper', () => { it('should cancel an order', async () => { const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); await zeroEx.awaitTransactionMinedAsync(txHash); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); + const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); }); }); @@ -502,8 +502,8 @@ describe('ExchangeWrapper', () => { describe('successful batch cancels', () => { it('should cancel a batch of orders', async () => { await zeroEx.exchange.batchCancelOrdersAsync(cancelBatch); - const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex); - const anotherCancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync( + const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex); + const anotherCancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync( anotherOrderHashHex, ); expect(cancelledAmount).to.be.bignumber.equal(cancelAmount); @@ -592,23 +592,23 @@ describe('ExchangeWrapper', () => { expect(filledValueT).to.be.bignumber.equal(partialFillAmount); }); }); - describe('#getCanceledTakerAmountAsync', () => { + describe('#getCancelledTakerAmountAsync', () => { it('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - return expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getCancelledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); }); it('should return zero if passed a valid but non-existent orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and partially filled orderHash', async () => { - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(0); }); it('should return the cancelledValueT for a valid and cancelled orderHash', async () => { const cancelAmount = fillableAmount.minus(partialFillAmount); await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); - const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(cancelAmount); }); }); diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts index c8a4a8064..810168aca 100644 --- a/packages/0x.js/test/order_state_watcher_test.ts +++ b/packages/0x.js/test/order_state_watcher_test.ts @@ -61,6 +61,12 @@ describe('OrderStateWatcher', () => { [makerToken, takerToken] = tokenUtils.getNonProtocolTokens(); web3Wrapper = (zeroEx as any)._web3Wrapper; }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); describe('#removeOrder', async () => { it('should successfully remove existing order', async () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( @@ -345,7 +351,7 @@ describe('OrderStateWatcher', () => { const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; - expect(orderRelevantState.canceledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); + expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); done(); }); zeroEx.orderStateWatcher.subscribe(callback); |