diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-16 08:18:19 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-16 08:18:19 +0800 |
commit | c325d638c98a990f2d0e991f2e03287183ba292f (patch) | |
tree | 59a9ad610c8d58fe471807683e918feb73c171ec /packages/connect/test | |
parent | e7f19e350ed9374729e73320d569294e88fde236 (diff) | |
download | dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar.gz dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar.bz2 dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar.lz dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar.xz dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.tar.zst dexon-sol-tools-c325d638c98a990f2d0e991f2e03287183ba292f.zip |
getAssetPairsAsync tests passing
Diffstat (limited to 'packages/connect/test')
3 files changed, 11 insertions, 13 deletions
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts index 9da2703df..a95bd25dd 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts @@ -1,4 +1,3 @@ - import { FeeRecipientsResponse } from '../../../src/types'; export const feeRecipientsResponse: FeeRecipientsResponse = { diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json index 4a2ab6914..8d2cdd8ed 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json +++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json @@ -17,4 +17,3 @@ }, "metaData": {} } - diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index fc5d01706..9cdcde71e 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -26,7 +26,7 @@ const expect = chai.expect; describe('HttpClient', () => { const relayUrl = 'https://example.com'; const relayerClient = new HttpClient(relayUrl); - afterEach(() => { + beforeEach(() => { fetchMock.restore(); }); describe('#constructor', () => { @@ -41,21 +41,21 @@ describe('HttpClient', () => { describe('#getAssetPairsAsync', () => { const url = `${relayUrl}/asset_pairs`; it('gets assetData pairs with default options when none are provided', async () => { - const urlWithQuery = `${url}?page=1&per_page=100`; + const urlWithQuery = `${url}?page=1&perPage=100`; fetchMock.get(urlWithQuery, assetDataPairsResponseJSON); const assetDataPairs = await relayerClient.getAssetPairsAsync(); expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse); }); it('gets assetData pairs with specified request options', async () => { - const assetDataAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d'; - const AssetPairsRequestOpts = { - assetDataA: assetDataAddress, + const assetData = '0xf47261b04c32345ced77393b3530b1eed0f346429d'; + const assetPairsRequestOpts = { + assetDataA: assetData, page: 3, perPage: 50, }; - const urlWithQuery = `${url}?page=3&per_page=50&assetDataA=${assetDataAddress}`; + const urlWithQuery = `${url}?assetDataA=${assetData}&page=3&perPage=50`; fetchMock.get(urlWithQuery, assetDataPairsResponseJSON); - const assetDataPairs = await relayerClient.getAssetPairsAsync(AssetPairsRequestOpts); + const assetDataPairs = await relayerClient.getAssetPairsAsync(assetPairsRequestOpts); expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse); }); it('throws an error for invalid JSON response', async () => { @@ -66,7 +66,7 @@ describe('HttpClient', () => { describe('#getOrdersAsync', () => { const url = `${relayUrl}/orders`; it('gets orders with default options when none are provided', async () => { - const urlWithQuery = `${url}?page=1&per_page=100`; + const urlWithQuery = `${url}?page=1&perPage=100`; fetchMock.get(urlWithQuery, ordersResponseJSON); const orders = await relayerClient.getOrdersAsync(); expect(orders).to.be.deep.equal(ordersResponse); @@ -78,7 +78,7 @@ describe('HttpClient', () => { page: 3, perPage: 50, }; - const urlWithQuery = `${url}?page=3&per_page=50&assetDataAddress=${assetDataAddress}`; + const urlWithQuery = `${url}?page=3&perPage=50&assetDataAddress=${assetDataAddress}`; fetchMock.get(urlWithQuery, ordersResponseJSON); const orders = await relayerClient.getOrdersAsync(ordersRequest); expect(orders).to.be.deep.equal(ordersResponse); @@ -110,7 +110,7 @@ describe('HttpClient', () => { it('gets orderbook with default page options when none are provided', async () => { const urlWithQuery = `${url}?baseAssetData=${ request.baseAssetData - }&page=1&per_page=100"eAssetData=${request.quoteAssetData}`; + }&page=1&perPage=100"eAssetData=${request.quoteAssetData}`; fetchMock.get(urlWithQuery, orderbookJSON); const orderbook = await relayerClient.getOrderbookAsync(request); expect(orderbook).to.be.deep.equal(orderbookResponse); @@ -118,7 +118,7 @@ describe('HttpClient', () => { it('gets orderbook with specified page options', async () => { const urlWithQuery = `${url}?baseAssetData=${ request.baseAssetData - }&page=3&per_page=50"eAssetData=${request.quoteAssetData}`; + }&page=3&perPage=50"eAssetData=${request.quoteAssetData}`; fetchMock.get(urlWithQuery, orderbookJSON); const pagedRequestOptions = { page: 3, |