This repository was archived by the owner on May 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed
Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ interface IEndpointFormValues {
1111}
1212const EndPoint = ( ) => {
1313 const default_endpoint = {
14- app_id : getAppId ( false ) ,
14+ app_id : getAppId ( ) ,
1515 server_url : OAUTH_URL ,
1616 } ;
1717
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ describe('Endpoint', () => {
2525 const app_id = screen . getByPlaceholderText ( 'e.g. 9999' ) ;
2626 expect ( server ) . toHaveValue ( 'oauth.deriv.com' ) ;
2727
28- expect ( app_id ) . toHaveValue ( '35073 ' ) ;
28+ expect ( app_id ) . toHaveValue ( '35074 ' ) ;
2929 } ) ;
3030
3131 it ( 'validate user inputs, and provides error messages for app id field' , async ( ) => {
Original file line number Diff line number Diff line change @@ -34,22 +34,23 @@ describe('Get an object with currency data', () => {
3434
3535describe ( 'Get App ID' , ( ) => {
3636 it ( "Should return 35074 when it's called in localhost environment" , ( ) => {
37- const appId = getAppId ( true ) ;
37+ window . location . hostname = 'localhost' ;
38+ const appId = getAppId ( ) ;
3839 expect ( appId ) . toBe ( '35074' ) ;
3940 } ) ;
4041 it ( "Should return 35073 when it's called in vercel environment" , ( ) => {
4142 window . location . hostname = 'deriv-api-docs.binary.sx' ;
42- const appId = getAppId ( false ) ;
43+ const appId = getAppId ( ) ;
4344 expect ( appId ) . toBe ( '35073' ) ;
4445 } ) ;
4546 it ( "Should return 36545 when it's called in staging environment" , ( ) => {
4647 window . location . hostname = 'staging-api.deriv.com' ;
47- const appId = getAppId ( false ) ;
48+ const appId = getAppId ( ) ;
4849 expect ( appId ) . toBe ( '36545' ) ;
4950 } ) ;
5051 it ( "Should return 36544 when it's called in production environment" , ( ) => {
5152 window . location . hostname = 'api.deriv.com' ;
52- const appId = getAppId ( false ) ;
53+ const appId = getAppId ( ) ;
5354 expect ( appId ) . toBe ( '36544' ) ;
5455 } ) ;
5556} ) ;
Original file line number Diff line number Diff line change @@ -59,10 +59,9 @@ export const isHost = (hostname: string) => {
5959 * @param isLocalHost {boolean} pass `true` if the project is running on localhost
6060 * @returns {string } proper appId for the project
6161 */
62- export const getAppId = ( isLocalHost : boolean ) => {
63- if ( isLocalHost ) return LOCALHOST_APP_ID ;
64-
62+ export const getAppId = ( ) => {
6563 // if not localhost, then one of the following:
64+ if ( isHost ( 'localhost' ) ) return LOCALHOST_APP_ID ;
6665 if ( isHost ( 'staging-api.deriv.com' ) ) return STAGING_APP_ID ;
6766 if ( isHost ( 'deriv-api-docs.binary.sx' ) ) return VERCEL_DEPLOYMENT_APP_ID ;
6867 if ( isHost ( 'api.deriv.com' ) ) return PRODUCTION_APP_ID ;
@@ -135,7 +134,7 @@ export const getServerConfig = () => {
135134 const isLocalHost = isHost ( 'localhost' ) ;
136135 return {
137136 serverUrl : DEFAULT_WS_SERVER ,
138- appId : getAppId ( isLocalHost ) ,
137+ appId : getAppId ( ) ,
139138 oauth : OAUTH_URL ,
140139 } ;
141140 }
You can’t perform that action at this time.
0 commit comments