diff options
author | Fabio Berger <me@fabioberger.com> | 2018-09-25 23:10:13 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-09-25 23:10:13 +0800 |
commit | 9eecf3683b674f0753e508476c4c21eb32625f18 (patch) | |
tree | 7098726b4a8189a29d01295d1f23a0df35ebafdb /packages/order-watcher/test | |
parent | 7570f3db513f1b728e27cdd6273642ab999adbcc (diff) | |
download | dexon-0x-contracts-9eecf3683b674f0753e508476c4c21eb32625f18.tar.gz dexon-0x-contracts-9eecf3683b674f0753e508476c4c21eb32625f18.tar.zst dexon-0x-contracts-9eecf3683b674f0753e508476c4c21eb32625f18.zip |
Add transactionHash to OrderState and emit it from OrderWatcher subscription
Diffstat (limited to 'packages/order-watcher/test')
-rw-r--r-- | packages/order-watcher/test/order_watcher_test.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 38bfde7ef..60d9069e8 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -250,6 +250,32 @@ describe('OrderWatcher', () => { await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress); })().catch(done); }); + it('should include transactionHash in emitted orderStateInvalid when watched order fully filled', (done: DoneCallback) => { + (async () => { + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + takerAddress, + fillableAmount, + ); + await orderWatcher.addOrderAsync(signedOrder); + + let transactionHash: string; + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { + expect(orderState.isValid).to.be.false(); + const invalidOrderState = orderState as OrderStateInvalid; + expect(invalidOrderState.transactionHash).to.be.equal(transactionHash); + }); + orderWatcher.subscribe(callback); + + transactionHash = await contractWrappers.exchange.fillOrderAsync( + signedOrder, + fillableAmount, + takerAddress, + ); + })().catch(done); + }); it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => { (async () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( |