diff options
Diffstat (limited to 'packages')
-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 |