diff options
author | Fabio Berger <me@fabioberger.com> | 2019-01-08 22:37:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2019-01-08 22:37:14 +0800 |
commit | 0ea86695524b91167f8824ba820eed4bb0ee6ee1 (patch) | |
tree | 90dea12ef9b19623c3a478fe72956480781b22bf | |
parent | 1631031fa74894143cb6835030b7dcd44d7c3c6b (diff) | |
download | dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar.gz dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar.bz2 dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar.lz dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar.xz dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.tar.zst dexon-sol-tools-0ea86695524b91167f8824ba820eed4bb0ee6ee1.zip |
Fixx OrderWatcher WS tests so they are completely independent from one another
-rw-r--r-- | packages/order-watcher/test/order_watcher_web_socket_server_test.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/packages/order-watcher/test/order_watcher_web_socket_server_test.ts b/packages/order-watcher/test/order_watcher_web_socket_server_test.ts index 6894f42fb..e3f416369 100644 --- a/packages/order-watcher/test/order_watcher_web_socket_server_test.ts +++ b/packages/order-watcher/test/order_watcher_web_socket_server_test.ts @@ -1,9 +1,10 @@ +import { ContractAddresses } from '@0x/contract-addresses'; import { ContractWrappers } from '@0x/contract-wrappers'; import { tokenUtils } from '@0x/contract-wrappers/lib/test/utils/token_utils'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { FillScenarios } from '@0x/fill-scenarios'; import { assetDataUtils, orderHashUtils } from '@0x/order-utils'; -import { ExchangeContractErrs, OrderStateInvalid, OrderStateValid, SignedOrder } from '@0x/types'; +import { ExchangeContractErrs, OrderStateInvalid, SignedOrder } from '@0x/types'; import { BigNumber, logUtils } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; @@ -44,14 +45,16 @@ describe('OrderWatcherWebSocketServer', async () => { let orderHash: string; let addOrderPayload: AddOrderRequest; let removeOrderPayload: RemoveOrderRequest; + let networkId: number; + let contractAddresses: ContractAddresses; const decimals = constants.ZRX_DECIMALS; const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals); before(async () => { // Set up constants - const contractAddresses = await migrateOnceAsync(); + contractAddresses = await migrateOnceAsync(); await blockchainLifecycle.startAsync(); - const networkId = constants.TESTRPC_NETWORK_ID; + networkId = constants.TESTRPC_NETWORK_ID; const config = { networkId, contractAddresses, @@ -93,17 +96,16 @@ describe('OrderWatcherWebSocketServer', async () => { method: OrderWatcherMethod.RemoveOrder, params: { orderHash }, }; - - // Prepare OrderWatcher WebSocket server - const orderWatcherConfig = { - isVerbose: true, - }; - wsServer = new OrderWatcherWebSocketServer(provider, networkId, contractAddresses, orderWatcherConfig); }); after(async () => { await blockchainLifecycle.revertAsync(); }); beforeEach(async () => { + // Prepare OrderWatcher WebSocket server + const orderWatcherConfig = { + isVerbose: true, + }; + wsServer = new OrderWatcherWebSocketServer(provider, networkId, contractAddresses, orderWatcherConfig); wsServer.start(); await blockchainLifecycle.startAsync(); wsClient = new WebSocket.w3cwebsocket('ws://127.0.0.1:8080/'); @@ -260,7 +262,7 @@ describe('OrderWatcherWebSocketServer', async () => { id: 1, jsonrpc: '2.0', method: 'ADD_ORDER', - signedOrder: nonZeroMakerFeeSignedOrder, + signedOrder: nonZeroMakerFeeSignedOrder, }; // Set up a second client and have it add the order |