@@ -36,12 +36,14 @@ describe('Namespace', function() {
3636 expect ( ( ) => Backendless . appId = 'appId' ) . to . throw ( )
3737 expect ( ( ) => Backendless . apiKey = 'apiKey' ) . to . throw ( )
3838 expect ( ( ) => Backendless . appPath = 'appPath' ) . to . throw ( )
39+ expect ( ( ) => Backendless . automationPath = 'automationPath' ) . to . throw ( )
3940 expect ( ( ) => Backendless . standalone = 'standalone' ) . to . throw ( )
4041 expect ( ( ) => Backendless . device = 'device' ) . to . throw ( )
4142
4243 expect ( Backendless . appId ) . to . be . equal ( APP_ID )
4344 expect ( Backendless . apiKey ) . to . be . equal ( API_KEY )
4445 expect ( Backendless . appPath ) . to . be . equal ( `http://foo.bar/${ APP_ID } /${ API_KEY } ` )
46+ expect ( Backendless . automationPath ) . to . be . equal ( `http://foo.bar/${ APP_ID } /${ API_KEY } ` )
4547 } )
4648 } )
4749
@@ -70,6 +72,32 @@ describe('Namespace', function() {
7072 expect ( app1 . apiKey ) . to . be . equal ( 'apiKey-1' )
7173 expect ( app1 . appPath ) . to . be . equal ( 'http://my-server-url.com/appId-1/apiKey-1' )
7274 } )
75+
76+ it ( 'has custom automationServerURL' , ( ) => {
77+ const app1 = Backendless . initApp ( {
78+ automationServerURL : 'http://my-automation-server-url.com' ,
79+ appId : 'appId-1' ,
80+ apiKey : 'apiKey-1' ,
81+ standalone : true
82+ } )
83+
84+ expect ( app1 . appId ) . to . be . equal ( 'appId-1' )
85+ expect ( app1 . apiKey ) . to . be . equal ( 'apiKey-1' )
86+ expect ( app1 . automationPath ) . to . be . equal ( 'http://my-automation-server-url.com/appId-1/apiKey-1' )
87+ } )
88+
89+ it ( 'should take default app path as automationServerURL when no value set' , ( ) => {
90+ const app1 = Backendless . initApp ( {
91+ serverURL : 'http://my-server-url.com' ,
92+ appId : 'appId-1' ,
93+ apiKey : 'apiKey-1' ,
94+ standalone : true
95+ } )
96+
97+ expect ( app1 . appId ) . to . be . equal ( 'appId-1' )
98+ expect ( app1 . apiKey ) . to . be . equal ( 'apiKey-1' )
99+ expect ( app1 . automationPath ) . to . be . equal ( 'http://my-server-url.com/appId-1/apiKey-1' )
100+ } )
73101 } )
74102
75103 describe ( 'Custom Domain' , ( ) => {
@@ -81,6 +109,7 @@ describe('Namespace', function() {
81109 expect ( Backendless . apiKey ) . to . be . equal ( null )
82110 expect ( Backendless . domain ) . to . be . equal ( CUSTOM_DOMAIN )
83111 expect ( Backendless . appPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /api` )
112+ expect ( Backendless . automationPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /api` )
84113 expect ( Backendless . apiURI ) . to . be . equal ( '/api' )
85114 } )
86115
@@ -91,6 +120,7 @@ describe('Namespace', function() {
91120 expect ( Backendless . apiKey ) . to . be . equal ( null )
92121 expect ( Backendless . domain ) . to . be . equal ( CUSTOM_DOMAIN )
93122 expect ( Backendless . appPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /api` )
123+ expect ( Backendless . automationPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /api` )
94124 expect ( Backendless . apiURI ) . to . be . equal ( '/api' )
95125 } )
96126
@@ -100,6 +130,7 @@ describe('Namespace', function() {
100130
101131 expect ( Backendless . domain ) . to . be . equal ( CUSTOM_DOMAIN )
102132 expect ( Backendless . appPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /my-api-uri` )
133+ expect ( Backendless . automationPath ) . to . be . equal ( `${ CUSTOM_DOMAIN } /my-api-uri` )
103134 expect ( Backendless . apiURI ) . to . be . equal ( '/my-api-uri' )
104135
105136 Backendless . apiURI = undefined
@@ -373,6 +404,7 @@ describe('Namespace', function() {
373404 expect ( Backendless . apiKey ) . to . be . equal ( null )
374405 expect ( Backendless . domain ) . to . be . equal ( 'https://foo.com' )
375406 expect ( Backendless . appPath ) . to . be . equal ( 'https://foo.com/api' )
407+ expect ( Backendless . automationPath ) . to . be . equal ( 'https://foo.com/api' )
376408 expect ( Backendless . apiURI ) . to . be . equal ( '/api' )
377409
378410 const appIdWarnMsg = 'getter/setter for Backendless.applicationId is deprecated, instead use Backendless.appId'
0 commit comments