aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/connect/test')
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts4
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts2
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts4
-rw-r--r--packages/connect/test/orderbook_channel_message_parsers_test.ts12
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);