diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-18 04:58:55 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-18 04:58:55 +0800 |
commit | f2d1d953553adfa59f0a39bf2cf98817fae0a4ff (patch) | |
tree | 572db33638e055725132756d24a866ec1a22e1d9 /packages/connect/test/http_client_test.ts | |
parent | 48ec78d3aaa5dcef8544d17f26ef8ea8b31661e5 (diff) | |
download | dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar.gz dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar.bz2 dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar.lz dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar.xz dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.tar.zst dexon-sol-tools-f2d1d953553adfa59f0a39bf2cf98817fae0a4ff.zip |
Remove default query parameters
Diffstat (limited to 'packages/connect/test/http_client_test.ts')
-rw-r--r-- | packages/connect/test/http_client_test.ts | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index cdff00a61..1c40cb10f 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -43,8 +43,7 @@ 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&perPage=100`; - fetchMock.get(urlWithQuery, assetDataPairsResponseJSON); + fetchMock.get(url, assetDataPairsResponseJSON); const assetDataPairs = await relayerClient.getAssetPairsAsync(); expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse); }); @@ -54,8 +53,9 @@ describe('HttpClient', () => { assetDataA: assetData, page: 3, perPage: 50, + networkdId: 42, }; - const urlWithQuery = `${url}?assetDataA=${assetData}&page=3&perPage=50`; + const urlWithQuery = `${url}?assetDataA=${assetData}&networkdId=42&page=3&perPage=50`; fetchMock.get(urlWithQuery, assetDataPairsResponseJSON); const assetDataPairs = await relayerClient.getAssetPairsAsync(assetPairsRequestOpts); expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse); @@ -68,8 +68,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&perPage=100`; - fetchMock.get(urlWithQuery, ordersResponseJSON); + fetchMock.get(url, ordersResponseJSON); const orders = await relayerClient.getOrdersAsync(); expect(orders).to.be.deep.equal(ordersResponse); }); @@ -79,8 +78,9 @@ describe('HttpClient', () => { assetDataAddress, page: 3, perPage: 50, + networkdId: 42, }; - const urlWithQuery = `${url}?assetDataAddress=${assetDataAddress}&page=3&perPage=50`; + const urlWithQuery = `${url}?assetDataAddress=${assetDataAddress}&networkdId=42&page=3&perPage=50`; fetchMock.get(urlWithQuery, ordersResponseJSON); const orders = await relayerClient.getOrdersAsync(ordersRequest); expect(orders).to.be.deep.equal(ordersResponse); @@ -112,7 +112,7 @@ describe('HttpClient', () => { it('gets orderbook with default page options when none are provided', async () => { const urlWithQuery = `${url}?baseAssetData=${ request.baseAssetData - }&page=1&perPage=100"eAssetData=${request.quoteAssetData}`; + }"eAssetData=${request.quoteAssetData}`; fetchMock.get(urlWithQuery, orderbookJSON); const orderbook = await relayerClient.getOrderbookAsync(request); expect(orderbook).to.be.deep.equal(orderbookResponse); @@ -120,11 +120,12 @@ describe('HttpClient', () => { it('gets orderbook with specified page options', async () => { const urlWithQuery = `${url}?baseAssetData=${ request.baseAssetData - }&page=3&perPage=50"eAssetData=${request.quoteAssetData}`; + }&networkId=42&page=3&perPage=50"eAssetData=${request.quoteAssetData}`; fetchMock.get(urlWithQuery, orderbookJSON); const pagedRequestOptions = { page: 3, perPage: 50, + networkId: 42, }; const orderbook = await relayerClient.getOrderbookAsync(request, pagedRequestOptions); expect(orderbook).to.be.deep.equal(orderbookResponse); @@ -146,7 +147,7 @@ describe('HttpClient', () => { exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', }; const url = `${relayUrl}/order_config`; - it('gets fees', async () => { + it('gets order config', async () => { fetchMock.post(url, orderConfigResponseJSON); const fees = await relayerClient.getOrderConfigAsync(request); expect(fees).to.be.deep.equal(orderConfigResponse); @@ -168,17 +169,18 @@ describe('HttpClient', () => { }); describe('#getFeeRecipientsAsync', () => { const url = `${relayUrl}/fee_recipients`; - it('gets orderbook with default page options when none are provided', async () => { + it('gets fee recipients with default page options when none are provided', async () => { fetchMock.get(url, feeRecipientsResponseJSON); const feeRecipients = await relayerClient.getFeeRecipientsAsync(); expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse); }); - it('gets orderbook with specified page options', async () => { - const urlWithQuery = `${url}?&page=3&perPage=50`; - fetchMock.get(url, feeRecipientsResponseJSON); + it('gets fee reciipient with specified page options', async () => { + const urlWithQuery = `${url}?networkId=42&page=3&perPage=50`; + fetchMock.get(urlWithQuery, feeRecipientsResponseJSON); const pagedRequestOptions = { page: 3, perPage: 50, + networkId: 42, }; const feeRecipients = await relayerClient.getFeeRecipientsAsync(pagedRequestOptions); expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse); @@ -189,3 +191,6 @@ describe('HttpClient', () => { }); }); }); + +// https://example.com/fee_recipients?networkId=42&page=3&perPage=50 +// https://example.com/fee_recipients?networkId=42&page=3&perPage=50
\ No newline at end of file |