From e744e4cd989bd3ae1070c59f7baa8097f18b8b06 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 22 Dec 2017 15:05:32 +0100 Subject: Apply prettier config --- .../test/fixtures/standard_relayer_api/fees.ts | 4 +-- ...f977fa9ac94a50f016026fd13f42990861238897721f.ts | 2 +- .../fixtures/standard_relayer_api/orderbook.ts | 2 +- .../test/fixtures/standard_relayer_api/orders.ts | 2 +- .../fixtures/standard_relayer_api/token_pairs.ts | 4 +-- packages/connect/test/http_client_test.ts | 30 ++++++++--------- .../test/orderbook_channel_message_parsers_test.ts | 17 +++++----- packages/connect/test/ws_orderbook_channel_test.ts | 39 +++++++++++++++------- 8 files changed, 57 insertions(+), 43 deletions(-) (limited to 'packages/connect/test') diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts index 68421880e..fc3292693 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fees.ts @@ -1,6 +1,6 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; -import {FeesResponse} from '../../../src/types'; +import { FeesResponse } from '../../../src/types'; export const feesResponse: FeesResponse = { feeRecipient: '0x323b5d4c32345ced77393b3530b1eed0f346429d', diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts index 9df45065c..f91ee75bd 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts @@ -1,4 +1,4 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; export const orderResponse = { maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b', diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts index 529d2b450..2c7ba1b98 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts @@ -1,4 +1,4 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; export const orderbookResponse = { bids: [ diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.ts b/packages/connect/test/fixtures/standard_relayer_api/orders.ts index 54c8a150d..62407c7cd 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orders.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orders.ts @@ -1,4 +1,4 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; export const ordersResponse = [ { diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts index b3ae7a1b1..17409a961 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts @@ -1,6 +1,6 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; -import {TokenPairsItem} from '../../../src/types'; +import { TokenPairsItem } from '../../../src/types'; export const tokenPairsResponse: TokenPairsItem[] = [ { diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 21e7abb69..150c1062b 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -1,24 +1,22 @@ -import {BigNumber} from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; import * as chai from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; import * as dirtyChai from 'dirty-chai'; import * as fetchMock from 'fetch-mock'; import 'mocha'; -import {HttpClient} from '../src/index'; +import { HttpClient } from '../src/index'; -import {feesResponse} from './fixtures/standard_relayer_api/fees'; +import { feesResponse } from './fixtures/standard_relayer_api/fees'; import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; -import { - orderResponse, -} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; +import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; // tslint:disable-next-line:max-line-length import * as orderResponseJSON from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; +import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook'; import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; -import {ordersResponse} from './fixtures/standard_relayer_api/orders'; +import { ordersResponse } from './fixtures/standard_relayer_api/orders'; import * as ordersResponseJSON from './fixtures/standard_relayer_api/orders.json'; -import {tokenPairsResponse} from './fixtures/standard_relayer_api/token_pairs'; +import { tokenPairsResponse } from './fixtures/standard_relayer_api/token_pairs'; import * as tokenPairsResponseJSON from './fixtures/standard_relayer_api/token_pairs.json'; chai.config.includeStack = true; @@ -50,7 +48,7 @@ describe('HttpClient', () => { expect(tokenPairs).to.be.deep.equal(tokenPairsResponse); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, {test: 'dummy'}); + fetchMock.get(url, { test: 'dummy' }); expect(relayerClient.getTokenPairsAsync()).to.be.rejected(); }); }); @@ -72,7 +70,7 @@ describe('HttpClient', () => { expect(orders).to.be.deep.equal(ordersResponse); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, {test: 'dummy'}); + fetchMock.get(url, { test: 'dummy' }); expect(relayerClient.getOrdersAsync()).to.be.rejected(); }); }); @@ -85,7 +83,7 @@ describe('HttpClient', () => { expect(order).to.be.deep.equal(orderResponse); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, {test: 'dummy'}); + fetchMock.get(url, { test: 'dummy' }); expect(relayerClient.getOrderAsync(orderHash)).to.be.rejected(); }); }); @@ -95,14 +93,16 @@ describe('HttpClient', () => { quoteTokenAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', }; // tslint:disable-next-line:max-line-length - const url = `${relayUrl}/v0/orderbook?baseTokenAddress=${request.baseTokenAddress}"eTokenAddress=${request.quoteTokenAddress}`; + const url = `${relayUrl}/v0/orderbook?baseTokenAddress=${request.baseTokenAddress}"eTokenAddress=${ + request.quoteTokenAddress + }`; it('gets order book', async () => { fetchMock.get(url, orderbookJSON); const orderbook = await relayerClient.getOrderbookAsync(request); expect(orderbook).to.be.deep.equal(orderbookResponse); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, {test: 'dummy'}); + fetchMock.get(url, { test: 'dummy' }); expect(relayerClient.getOrderbookAsync(request)).to.be.rejected(); }); }); @@ -125,7 +125,7 @@ describe('HttpClient', () => { expect(fees).to.be.deep.equal(feesResponse); }); it('throws an error for invalid JSON response', async () => { - fetchMock.post(url, {test: 'dummy'}); + fetchMock.post(url, { test: 'dummy' }); expect(relayerClient.getFeesAsync(request)).to.be.rejected(); }); }); diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts index 2c776b095..5ca3433b9 100644 --- a/packages/connect/test/orderbook_channel_message_parsers_test.ts +++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts @@ -2,16 +2,16 @@ import * as chai from 'chai'; import * as dirtyChai from 'dirty-chai'; import 'mocha'; -import {orderbookChannelMessageParsers} from '../src/utils/orderbook_channel_message_parsers'; +import { orderbookChannelMessageParsers } from '../src/utils/orderbook_channel_message_parsers'; // tslint:disable-next-line:max-line-length -import {orderResponse} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; +import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; +import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook'; import { malformedSnapshotOrderbookChannelMessage, snapshotOrderbookChannelMessage, } from './fixtures/standard_relayer_api/snapshot_orderbook_channel_message'; -import {unknownOrderbookChannelMessage} from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; +import { unknownOrderbookChannelMessage } from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; import { malformedUpdateOrderbookChannelMessage, updateOrderbookChannelMessage, @@ -58,15 +58,14 @@ describe('orderbookChannelMessageParsers', () => { 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); + const badCall = () => orderbookChannelMessageParsers.parser(malformedSnapshotOrderbookChannelMessage); // tslint:disable-next-line:max-line-length - const errMsg = 'Validation errors: instance.payload requires property "bids", instance.payload requires property "asks"'; + const errMsg = + 'Validation errors: instance.payload requires property "bids", instance.payload requires property "asks"'; expect(badCall).throws(errMsg); }); it('throws when update message has malformed payload', () => { - const badCall = () => - orderbookChannelMessageParsers.parser(malformedUpdateOrderbookChannelMessage); + const badCall = () => orderbookChannelMessageParsers.parser(malformedUpdateOrderbookChannelMessage); expect(badCall).throws(/^Expected message to conform to schema/); }); it('throws when input message is not valid JSON', () => { diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index 6190a5ac3..82a5da0a8 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -3,9 +3,7 @@ import * as dirtyChai from 'dirty-chai'; import * as _ from 'lodash'; import 'mocha'; -import { - WebSocketOrderbookChannel, -} from '../src/ws_orderbook_channel'; +import { WebSocketOrderbookChannel } from '../src/ws_orderbook_channel'; chai.config.includeStack = true; chai.use(dirtyChai); @@ -21,26 +19,43 @@ describe('WebSocketOrderbookChannel', () => { limit: 100, }; const emptyOrderbookChannelHandler = { - onSnapshot: () => { _.noop(); }, - onUpdate: () => { _.noop(); }, - onError: () => { _.noop(); }, - onClose: () => { _.noop(); }, + onSnapshot: () => { + _.noop(); + }, + onUpdate: () => { + _.noop(); + }, + onError: () => { + _.noop(); + }, + onClose: () => { + _.noop(); + }, }; describe('#subscribe', () => { it('throws when subscriptionOpts does not conform to schema', () => { const badSubscribeCall = orderbookChannel.subscribe.bind( - orderbookChannel, {}, emptyOrderbookChannelHandler); + orderbookChannel, + {}, + emptyOrderbookChannelHandler, + ); // tslint:disable-next-line:max-line-length - expect(badSubscribeCall).throws('Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"'); + expect(badSubscribeCall).throws( + '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'); + 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, subscriptionOpts, emptyOrderbookChannelHandler); + orderbookChannel, + subscriptionOpts, + emptyOrderbookChannelHandler, + ); expect(goodSubscribeCall).to.not.throw(); }); }); -- cgit v1.2.3 From d46fcb33c5874220d1383ef21353345a99d84cf5 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 3 Jan 2018 11:42:20 +0100 Subject: Fix formatting --- packages/connect/test/http_client_test.ts | 2 -- packages/connect/test/orderbook_channel_message_parsers_test.ts | 2 -- packages/connect/test/ws_orderbook_channel_test.ts | 1 - 3 files changed, 5 deletions(-) (limited to 'packages/connect/test') diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 150c1062b..72d6ec0d6 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -10,7 +10,6 @@ import { HttpClient } from '../src/index'; import { feesResponse } from './fixtures/standard_relayer_api/fees'; import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; -// tslint:disable-next-line:max-line-length import * as orderResponseJSON from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json'; import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook'; import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; @@ -92,7 +91,6 @@ describe('HttpClient', () => { baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d', quoteTokenAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', }; - // tslint:disable-next-line:max-line-length const url = `${relayUrl}/v0/orderbook?baseTokenAddress=${request.baseTokenAddress}"eTokenAddress=${ request.quoteTokenAddress }`; diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts index 5ca3433b9..e6cc05fed 100644 --- a/packages/connect/test/orderbook_channel_message_parsers_test.ts +++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts @@ -4,7 +4,6 @@ import 'mocha'; import { orderbookChannelMessageParsers } from '../src/utils/orderbook_channel_message_parsers'; -// tslint:disable-next-line:max-line-length import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook'; import { @@ -59,7 +58,6 @@ describe('orderbookChannelMessageParsers', () => { }); it('throws when snapshot message has malformed payload', () => { const badCall = () => orderbookChannelMessageParsers.parser(malformedSnapshotOrderbookChannelMessage); - // tslint:disable-next-line:max-line-length const errMsg = 'Validation errors: instance.payload requires property "bids", instance.payload requires property "asks"'; expect(badCall).throws(errMsg); diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index 82a5da0a8..ce404d934 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -39,7 +39,6 @@ describe('WebSocketOrderbookChannel', () => { {}, emptyOrderbookChannelHandler, ); - // tslint:disable-next-line:max-line-length expect(badSubscribeCall).throws( 'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"', ); -- cgit v1.2.3