Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 65c4538

Browse files
authored
Merge pull request #171 from hubert-deriv/fixing_endpoint_url3
2 parents 07988f4 + 07bb4f6 commit 65c4538

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/hooks/useLoginUrl/__tests__/useLoginUrl.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as utils from '@site/src/utils';
55

66
jest
77
.spyOn(utils, 'getServerConfig')
8-
.mockReturnValue({ appId: '1234', serverUrl: 'test.binary.sx', oauth: 'test.deriv.com' });
8+
.mockReturnValue({ appId: '1234', serverUrl: 'test.binary.sx', oauth: 'test.oauth.sx' });
99

1010
describe('Use Login URL', () => {
1111
afterEach(() => {
@@ -23,7 +23,7 @@ describe('Use Login URL', () => {
2323

2424
expect(loginUrl).toContain('l=en');
2525
expect(utils.getServerConfig).toHaveBeenCalled();
26-
expect(loginUrl).toMatch('https://test.deriv.com/oauth2/authorize?app_id=1234&l=en');
26+
expect(loginUrl).toMatch('https://test.oauth.sx/oauth2/authorize?app_id=1234&l=en');
2727
expect(loginUrl).toMatch(/app_id=1234/);
2828
});
2929

@@ -37,7 +37,7 @@ describe('Use Login URL', () => {
3737

3838
expect(loginUrl).toContain('l=es');
3939
expect(utils.getServerConfig).toHaveBeenCalled();
40-
expect(loginUrl).toMatch('https://test.deriv.com/oauth2/authorize?app_id=1234&l=es');
40+
expect(loginUrl).toMatch('https://test.oauth.sx/oauth2/authorize?app_id=1234&l=es');
4141
expect(loginUrl).toMatch(/app_id=1234/);
4242
});
4343
});

src/utils/__tests__/utils.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import * as utils from '@site/src/utils';
2-
import { DEFAULT_WS_SERVER, LOCALHOST_APP_ID, VERCEL_DEPLOYMENT_APP_ID } from '../constants';
2+
import {
3+
LOCALHOST_APP_ID,
4+
VERCEL_DEPLOYMENT_APP_ID,
5+
OAUTH_URL,
6+
DEFAULT_WS_SERVER,
7+
} from '../constants';
38
const {
49
getAccountsFromSearchParams,
510
getAppId,
@@ -174,7 +179,7 @@ describe('Get Server Config', () => {
174179

175180
const serverConfig = getServerConfig();
176181
expect(serverConfig.appId).toBe('1234');
177-
expect(serverConfig.serverUrl).toBe('test.binary.sx');
182+
expect(serverConfig.serverUrl).toBe('ws.binaryws.com');
178183
expect(localStorage.getItem).toHaveBeenCalledTimes(2);
179184
});
180185
});

src/utils/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import moment from 'moment';
22
import { IUserLoginAccount } from '../contexts/auth/auth.context';
33
import { TScopes } from '../types';
44
import {
5-
DEFAULT_WS_SERVER,
65
LOCALHOST_APP_ID,
76
PRODUCTION_APP_ID,
87
STAGING_APP_ID,
98
VERCEL_DEPLOYMENT_APP_ID,
109
OAUTH_URL,
10+
DEFAULT_WS_SERVER,
1111
} from './constants';
1212

1313
const CURRENCY_MAP = new Map([
@@ -129,9 +129,9 @@ export const getServerConfig = () => {
129129
const config_app_id = localStorage.getItem('config.app_id');
130130
if (config_app_id && config_server_url) {
131131
return {
132-
serverUrl: config_server_url,
132+
serverUrl: DEFAULT_WS_SERVER,
133133
appId: config_app_id,
134-
oauth: OAUTH_URL,
134+
oauth: config_server_url,
135135
};
136136
} else {
137137
const isLocalHost = isHost('localhost');

0 commit comments

Comments
 (0)