Skip to content

Commit

Permalink
test: Improve overall code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Apr 26, 2021
1 parent b6d57e8 commit c000fda
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/client/RESTClient.test.ts
Expand Up @@ -10,9 +10,8 @@ describe('RESTClient', () => {
}

describe('defaults', () => {
xit('supports overriding the timeout limit', () => {
it('supports overriding the timeout limit', () => {
const rest = createRESTClient();
expect(rest.defaults.timeout).toBe(5000);
rest.defaults.timeout = 2500;
expect(rest.defaults.timeout).toBe(2500);
});
Expand Down
8 changes: 3 additions & 5 deletions src/client/RESTClient.ts
Expand Up @@ -76,12 +76,10 @@ export class RESTClient {

const {accessToken, accountId, securityToken, clientSessionToken} = this.auth;

if (config.url === '/session' && config.method == 'put') {
if (config.url === LoginAPI.URL.SESSION && config.method === 'put') {
// Edge case to switch accounts which doesn't work with Bearer tokens
if (securityToken && clientSessionToken) {
updatedHeaders['X-SECURITY-TOKEN'] = securityToken;
updatedHeaders.CST = clientSessionToken;
}
updatedHeaders['X-SECURITY-TOKEN'] = securityToken;
updatedHeaders.CST = clientSessionToken;
} else {
if (accessToken) {
updatedHeaders.Authorization = 'Bearer ' + accessToken;
Expand Down
5 changes: 4 additions & 1 deletion src/dealing/DealingAPI.test.ts
Expand Up @@ -398,7 +398,7 @@ describe('DealingAPI', () => {
});

describe('failedDelete', () => {
xit('fails to delete an order', async () => {
it('fails to delete an order', async () => {
const dealId = '12345';

nock(APIClient.URL_DEMO)
Expand All @@ -413,6 +413,9 @@ describe('DealingAPI', () => {
)
.reply(403);

global.client.rest.defaults['axios-retry'] = {
retries: 1,
};
await expectAsync(global.client.rest.dealing.deleteOrder(dealId)).toBeRejected();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/login/LoginAPI.ts
Expand Up @@ -56,7 +56,7 @@ export class LoginAPI {
retries: 0,
},
headers: {
Version: '3',
VERSION: '3',
},
}
);
Expand Down

0 comments on commit c000fda

Please sign in to comment.