diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-05-30 02:36:19 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-07-12 01:25:54 +0800 |
commit | c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f (patch) | |
tree | b63108122b9a763d4e61572c642b79f855da7da4 /packages/connect/test | |
parent | c500cc095f5c5adb6da3aaf85ad245531531f215 (diff) | |
download | dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar.gz dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar.bz2 dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar.lz dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar.xz dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.tar.zst dexon-sol-tools-c403dcdabf4b98ea0ecde1ab0e7e9dafa97d797f.zip |
Update tests
Diffstat (limited to 'packages/connect/test')
-rw-r--r-- | packages/connect/test/ws_orderbook_channel_test.ts | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index 79100d0e2..f4ad67ba3 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -9,31 +9,31 @@ import { WebSocketOrderbookChannel } from '../src/ws_orderbook_channel'; chai.config.includeStack = true; chai.use(dirtyChai); const expect = chai.expect; +const emptyOrderbookChannelHandler = { + onSnapshot: () => { + _.noop(); + }, + onUpdate: () => { + _.noop(); + }, + onError: () => { + _.noop(); + }, + onClose: () => { + _.noop(); + }, +}; describe('WebSocketOrderbookChannel', () => { const websocketUrl = 'ws://localhost:8080'; const client = new WebSocket.w3cwebsocket(websocketUrl); - const orderbookChannel = new WebSocketOrderbookChannel(client); + const orderbookChannel = new WebSocketOrderbookChannel(client, emptyOrderbookChannelHandler); const subscriptionOpts = { baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d', quoteTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990', snapshot: true, limit: 100, }; - const emptyOrderbookChannelHandler = { - onSnapshot: () => { - _.noop(); - }, - onUpdate: () => { - _.noop(); - }, - onError: () => { - _.noop(); - }, - onClose: () => { - _.noop(); - }, - }; describe('#subscribe', () => { it('throws when subscriptionOpts does not conform to schema', () => { const badSubscribeCall = orderbookChannel.subscribe.bind( @@ -45,12 +45,6 @@ describe('WebSocketOrderbookChannel', () => { 'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"', ); }); - it('throws when handler has the incorrect members', () => { - const badSubscribeCall = orderbookChannel.subscribe.bind(orderbookChannel, subscriptionOpts, {}); - expect(badSubscribeCall).throws( - 'Expected handler.onSnapshot to be of type function, encountered: undefined', - ); - }); it('does not throw when inputs are of correct types', () => { const goodSubscribeCall = orderbookChannel.subscribe.bind( orderbookChannel, |