Skip to content

Commit

Permalink
fix TS 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Sep 4, 2021
1 parent 883aa1d commit 61d8b3d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dealing/DealingAPI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
PositionUpdateRequest,
} from './DealingAPI';
import {LoginAPI} from '../login';
import {AxiosError} from 'axios';

describe('DealingAPI', () => {
describe('getAllOpenPositions', () => {
Expand Down Expand Up @@ -421,8 +422,10 @@ describe('DealingAPI', () => {
await global.client.rest.dealing.deleteOrder(dealId);
fail('Expected error');
} catch (error) {
expect(error.isAxiosError).toBe(true);
expect(error.config['axios-retry'].retryCount).toBe(amountOfRetries);
const axiosError = error as AxiosError;
expect(axiosError.isAxiosError).toBe(true);
// Any typing because of: https://github.com/softonic/axios-retry/pull/174
expect((axiosError.config['axios-retry'] as any).retryCount).toBe(amountOfRetries);
}
}, 10_000);

Expand Down Expand Up @@ -504,8 +507,9 @@ describe('DealingAPI', () => {
await apiClient.rest.dealing.deleteOrder(dealId);
fail('Expected error');
} catch (error) {
const expectedError = error as Error;
expect(createSession).not.toHaveBeenCalled();
expect(error.message).toBe(
expect(expectedError.message).toBe(
'Cannot fulfill request because there is no active session and username & password have not been provided.'
);
}
Expand Down

0 comments on commit 61d8b3d

Please sign in to comment.