diff options
author | Fabio Berger <me@fabioberger.com> | 2018-09-25 23:37:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 23:37:24 +0800 |
commit | b73df28454bf72c0e68b1150ca6ee0ea3ead1382 (patch) | |
tree | 3399190d93a008f6a1261fd4afb0d6f53877209b /packages/order-watcher/test/order_watcher_test.ts | |
parent | 7570f3db513f1b728e27cdd6273642ab999adbcc (diff) | |
parent | 5afc73939785a9b5c6c73773b8f8eac4429762ef (diff) | |
download | dexon-sol-tools-b73df28454bf72c0e68b1150ca6ee0ea3ead1382.tar.gz dexon-sol-tools-b73df28454bf72c0e68b1150ca6ee0ea3ead1382.tar.zst dexon-sol-tools-b73df28454bf72c0e68b1150ca6ee0ea3ead1382.zip |
Merge pull request #1087 from 0xProject/addTxHashToOrderState
Add transactionHash to OrderState and emit it from OrderWatcher
Diffstat (limited to 'packages/order-watcher/test/order_watcher_test.ts')
-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( |