aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/test
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-16 08:52:13 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-16 08:52:13 +0800
commitca5e52920d5fd8388fc1f62f0a98908adfc69c08 (patch)
treefb0b468195aa991fd9ad5065afb2d7882543077b /packages/connect/test
parent30dfb7511dc695b2dc7514c2908e632e0969ddfd (diff)
downloaddexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar.gz
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar.bz2
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar.lz
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar.xz
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.tar.zst
dexon-sol-tools-ca5e52920d5fd8388fc1f62f0a98908adfc69c08.zip
Add fee recipients test
Diffstat (limited to 'packages/connect/test')
-rw-r--r--packages/connect/test/http_client_test.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts
index 6d5ab288a..cdff00a61 100644
--- a/packages/connect/test/http_client_test.ts
+++ b/packages/connect/test/http_client_test.ts
@@ -17,6 +17,8 @@ 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 * as ordersResponseJSON from './fixtures/standard_relayer_api/orders.json';
+import { feeRecipientsResponse } from './fixtures/standard_relayer_api/fee_recipients';
+import * as feeRecipientsResponseJSON from './fixtures/standard_relayer_api/fee_recipients.json';
chai.config.includeStack = true;
chai.use(dirtyChai);
@@ -164,4 +166,26 @@ describe('HttpClient', () => {
expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected();
});
});
+ describe('#getFeeRecipientsAsync', () => {
+ const url = `${relayUrl}/fee_recipients`;
+ it('gets orderbook 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);
+ const pagedRequestOptions = {
+ page: 3,
+ perPage: 50,
+ };
+ const feeRecipients = await relayerClient.getFeeRecipientsAsync(pagedRequestOptions);
+ expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
+ });
+ it('throws an error for invalid JSON response', async () => {
+ fetchMock.get(url, { test: 'dummy' });
+ expect(relayerClient.getFeeRecipientsAsync()).to.be.rejected();
+ });
+ });
});