diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-22 02:21:49 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-22 02:21:49 +0800 |
commit | 351b7557b65e4cdef2177585d52021ee5a0f3e42 (patch) | |
tree | 22c09c3e9c1ee8f2aebec71c7e1467a6442d9569 | |
parent | 4dc1962f9ec2c537b7944246842d934c3aee186d (diff) | |
download | dexon-sol-tools-351b7557b65e4cdef2177585d52021ee5a0f3e42.tar.gz dexon-sol-tools-351b7557b65e4cdef2177585d52021ee5a0f3e42.tar.zst dexon-sol-tools-351b7557b65e4cdef2177585d52021ee5a0f3e42.zip |
Fix tests
-rw-r--r-- | packages/0x.js/src/order_watcher/expiration_watcher.ts | 3 | ||||
-rw-r--r-- | packages/0x.js/test/expiration_watcher_test.ts | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts index 21b239be1..5aa8b3d17 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts @@ -58,7 +58,8 @@ export class ExpirationWatcher { this.orderHashByExpirationRBTree.size !== 0 && this.expiration[this.orderHashByExpirationRBTree.min()].lessThan( currentUnixTimestampMs.plus(this.expirationMarginMs), - ) + ) && + !_.isUndefined(this.orderExpirationCheckingIntervalIdIfExists) ) { const orderHash = this.orderHashByExpirationRBTree.min(); this.orderHashByExpirationRBTree.remove(orderHash); diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/0x.js/test/expiration_watcher_test.ts index 19c08a811..0d5ebb909 100644 --- a/packages/0x.js/test/expiration_watcher_test.ts +++ b/packages/0x.js/test/expiration_watcher_test.ts @@ -72,10 +72,10 @@ describe('ExpirationWatcher', () => { expirationUnixTimestampSec, ); const orderHash = ZeroEx.getOrderHashHex(signedOrder); - expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec); + expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000)); const callbackAsync = reportCallbackErrors(done)(async (hash: string) => { expect(hash).to.be.equal(orderHash); - expect(utils.getCurrentUnixTimestampSec()).to.be.bignumber.above(expirationUnixTimestampSec); + expect(utils.getCurrentUnixTimestampSec()).to.be.bignumber.gte(expirationUnixTimestampSec); done(); }); expirationWatcher.subscribe(callbackAsync); @@ -91,7 +91,7 @@ describe('ExpirationWatcher', () => { expirationUnixTimestampSec, ); const orderHash = ZeroEx.getOrderHashHex(signedOrder); - expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec); + expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000)); const callbackAsync = reportCallbackErrors(done)(async (hash: string) => { done(new Error('Emitted expiration went before the order actually expired')); }); @@ -117,8 +117,8 @@ describe('ExpirationWatcher', () => { ); const orderHash1 = ZeroEx.getOrderHashHex(signedOrder1); const orderHash2 = ZeroEx.getOrderHashHex(signedOrder2); - expirationWatcher.addOrder(orderHash2, signedOrder2.expirationUnixTimestampSec); - expirationWatcher.addOrder(orderHash1, signedOrder1.expirationUnixTimestampSec); + expirationWatcher.addOrder(orderHash2, signedOrder2.expirationUnixTimestampSec.times(1000)); + expirationWatcher.addOrder(orderHash1, signedOrder1.expirationUnixTimestampSec.times(1000)); const expirationOrder = [orderHash1, orderHash2]; const callbackAsync = reportCallbackErrors(done)(async (hash: string) => { const orderHash = expirationOrder.shift(); |