aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-24 05:56:42 +0800
committerFabio Berger <me@fabioberger.com>2017-11-24 05:56:42 +0800
commitf0b3ee84b47f1b7548ac688a4e44208be1b2eb1f (patch)
tree72c60487266593bf2cfe67a9ce845c130bf0e5f2 /packages
parentab78c54d6a6e8592c43b779b651cc7203de2e66e (diff)
downloaddexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar.gz
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar.bz2
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar.lz
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar.xz
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.tar.zst
dexon-0x-contracts-f0b3ee84b47f1b7548ac688a4e44208be1b2eb1f.zip
Fix tests now that we no longer fire duplicate orderWatcher events
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/test/order_state_watcher_test.ts18
1 files changed, 3 insertions, 15 deletions
diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts
index 834099ef6..e635071b8 100644
--- a/packages/0x.js/test/order_state_watcher_test.ts
+++ b/packages/0x.js/test/order_state_watcher_test.ts
@@ -180,16 +180,12 @@ describe('OrderStateWatcher', () => {
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
await zeroEx.orderStateWatcher.addOrderAsync(signedOrder);
- let eventCount = 0;
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
- eventCount++;
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
- if (eventCount === 2) {
- done();
- }
+ done();
});
zeroEx.orderStateWatcher.subscribe(callback);
@@ -212,9 +208,7 @@ describe('OrderStateWatcher', () => {
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
await zeroEx.orderStateWatcher.addOrderAsync(signedOrder);
- let eventCount = 0;
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
- eventCount++;
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
@@ -226,9 +220,7 @@ describe('OrderStateWatcher', () => {
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
remainingFillable);
expect(orderRelevantState.makerBalance).to.be.bignumber.equal(remainingMakerBalance);
- if (eventCount === 2) {
- done();
- }
+ done();
});
zeroEx.orderStateWatcher.subscribe(callback);
const shouldThrowOnInsufficientBalanceOrAllowance = true;
@@ -267,9 +259,7 @@ describe('OrderStateWatcher', () => {
const fillAmountInBaseUnits = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
await zeroEx.orderStateWatcher.addOrderAsync(signedOrder);
- let eventCount = 0;
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
- eventCount++;
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
@@ -278,9 +268,7 @@ describe('OrderStateWatcher', () => {
ZeroEx.toBaseUnitAmount(new BigNumber(16), decimals));
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
ZeroEx.toBaseUnitAmount(new BigNumber(8), decimals));
- if (eventCount === 2) {
- done();
- }
+ done();
});
zeroEx.orderStateWatcher.subscribe(callback);
const shouldThrowOnInsufficientBalanceOrAllowance = true;