diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-12-06 20:52:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-06 20:52:22 +0800 |
commit | 594bd2de1ccb41e34729834d67eba617baf1aa80 (patch) | |
tree | b623eb0ed7698b2f0076871fa8bd2bb12298c5c7 /packages/connect/test | |
parent | 55083316fc7f4bcfbb77470a3f66e621a68ebb95 (diff) | |
parent | f0c27f98b809afda3c750e77dbd3f35ccd29ec01 (diff) | |
download | dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar.gz dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar.bz2 dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar.lz dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar.xz dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.tar.zst dexon-sol-tools-594bd2de1ccb41e34729834d67eba617baf1aa80.zip |
Merge branch 'development' into feature/airport-experiments
Diffstat (limited to 'packages/connect/test')
4 files changed, 16 insertions, 6 deletions
diff --git a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts index 3cedafb20..1d7e67055 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts @@ -5,13 +5,13 @@ const orderbookJsonString = JSON.stringify(orderbookJSON); export const snapshotOrderbookChannelMessage = `{ "type": "snapshot", "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": ${orderbookJsonString} }`; export const malformedSnapshotOrderbookChannelMessage = `{ "type": "snapshot", "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": {} }`; diff --git a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts index 842738d99..cbedff60e 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts @@ -5,6 +5,6 @@ const orderJSONString = JSON.stringify(orderResponseJSON); export const unknownOrderbookChannelMessage = `{ "type": "superGoodUpdate", "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": ${orderJSONString} }`; diff --git a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts index bc83854c6..0e2c7523b 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts @@ -5,13 +5,13 @@ const orderJSONString = JSON.stringify(orderResponseJSON); export const updateOrderbookChannelMessage = `{ "type": "update", "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": ${orderJSONString} }`; export const malformedUpdateOrderbookChannelMessage = `{ "type": "update", "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": {} }`; diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts index 0ad0b12b3..2c776b095 100644 --- a/packages/connect/test/orderbook_channel_message_parsers_test.ts +++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts @@ -41,12 +41,22 @@ describe('orderbookChannelMessageParsers', () => { it('throws when message does not include a type', () => { const typelessMessage = `{ "channel": "orderbook", - "channelId": 1, + "requestId": 1, "payload": {} }`; const badCall = () => orderbookChannelMessageParsers.parser(typelessMessage); expect(badCall).throws(`Message is missing a type parameter: ${typelessMessage}`); }); + it('throws when type is not a string', () => { + const messageWithBadType = `{ + "type": 1, + "channel": "orderbook", + "requestId": 1, + "payload": {} + }`; + const badCall = () => orderbookChannelMessageParsers.parser(messageWithBadType); + expect(badCall).throws('Expected type to be of type string, encountered: 1'); + }); it('throws when snapshot message has malformed payload', () => { const badCall = () => orderbookChannelMessageParsers.parser(malformedSnapshotOrderbookChannelMessage); |