diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-12-05 15:58:33 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-12-06 03:28:32 +0800 |
commit | 20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414 (patch) | |
tree | 7d9e64905865dfb81b91b287f0c93a34dbc028ef /packages/connect/test | |
parent | c0015c2c118c0fd563fa8d2ee672c28dca7ef809 (diff) | |
download | dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.gz dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.tar.zst dexon-sol-tools-20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414.zip |
Add requestId to subscription messages and update json-schemas
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); |