aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-25 23:10:13 +0800
committerFabio Berger <me@fabioberger.com>2018-09-25 23:10:13 +0800
commit9eecf3683b674f0753e508476c4c21eb32625f18 (patch)
tree7098726b4a8189a29d01295d1f23a0df35ebafdb /packages/order-watcher/test
parent7570f3db513f1b728e27cdd6273642ab999adbcc (diff)
downloaddexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar
dexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar.gz
dexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar.bz2
dexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar.lz
dexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar.xz
dexon-sol-tools-9eecf3683b674f0753e508476c4c21eb32625f18.tar.zst
dexon-sol-tools-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.ts26
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(