@@ -24,8 +24,8 @@ define(['ably', 'chai'], function (Ably, chai) {
2424 helper . recordPrivateApi ( 'call.Defaults.normaliseOptions' ) ;
2525 var normalisedOptions = Defaults . normaliseOptions ( { } , null , null ) ;
2626
27- expect ( normalisedOptions . restHost ) . to . equal ( 'rest. ably.io ' ) ;
28- expect ( normalisedOptions . realtimeHost ) . to . equal ( 'realtime.ably.io ' ) ;
27+ expect ( normalisedOptions . restHost ) . to . equal ( 'main.realtime. ably.net ' ) ;
28+ expect ( normalisedOptions . realtimeHost ) . to . equal ( 'main. realtime.ably.net ' ) ;
2929 expect ( normalisedOptions . port ) . to . equal ( 80 ) ;
3030 expect ( normalisedOptions . tlsPort ) . to . equal ( 443 ) ;
3131 expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal ( Defaults . FALLBACK_HOSTS . sort ( ) ) ;
@@ -35,8 +35,10 @@ define(['ably', 'chai'], function (Ably, chai) {
3535 expect ( Defaults . getHosts ( normalisedOptions ) . length ) . to . equal ( 4 ) ;
3636 expect ( Defaults . getHosts ( normalisedOptions ) [ 0 ] ) . to . deep . equal ( normalisedOptions . restHost ) ;
3737 helper . recordPrivateApi ( 'call.Defaults.getHost' ) ;
38- expect ( Defaults . getHost ( normalisedOptions , 'rest.ably.io' , false ) ) . to . deep . equal ( 'rest.ably.io' ) ;
39- expect ( Defaults . getHost ( normalisedOptions , 'rest.ably.io' , true ) ) . to . equal ( 'realtime.ably.io' ) ;
38+ expect ( Defaults . getHost ( normalisedOptions , 'main.realtime.ably.net' , false ) ) . to . deep . equal (
39+ 'main.realtime.ably.net' ,
40+ ) ;
41+ expect ( Defaults . getHost ( normalisedOptions , 'main.realtime.ably.net' , true ) ) . to . equal ( 'main.realtime.ably.net' ) ;
4042
4143 helper . recordPrivateApi ( 'call.Defaults.getPort' ) ;
4244 expect ( Defaults . getPort ( normalisedOptions ) ) . to . equal ( 443 ) ;
@@ -65,8 +67,8 @@ define(['ably', 'chai'], function (Ably, chai) {
6567 helper . recordPrivateApi ( 'call.Defaults.normaliseOptions' ) ;
6668 var normalisedOptions = Defaults . normaliseOptions ( { environment : 'production' } , null , null ) ;
6769
68- expect ( normalisedOptions . restHost ) . to . equal ( 'rest. ably.io ' ) ;
69- expect ( normalisedOptions . realtimeHost ) . to . equal ( 'realtime.ably.io ' ) ;
70+ expect ( normalisedOptions . restHost ) . to . equal ( 'main.realtime. ably.net ' ) ;
71+ expect ( normalisedOptions . realtimeHost ) . to . equal ( 'main. realtime.ably.net ' ) ;
7072 expect ( normalisedOptions . port ) . to . equal ( 80 ) ;
7173 expect ( normalisedOptions . tlsPort ) . to . equal ( 443 ) ;
7274 expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal ( Defaults . FALLBACK_HOSTS . sort ( ) ) ;
@@ -76,8 +78,12 @@ define(['ably', 'chai'], function (Ably, chai) {
7678 expect ( Defaults . getHosts ( normalisedOptions ) . length ) . to . deep . equal ( 4 ) ;
7779 expect ( Defaults . getHosts ( normalisedOptions ) [ 0 ] ) . to . deep . equal ( normalisedOptions . restHost ) ;
7880 helper . recordPrivateApi ( 'call.Defaults.getHost' ) ;
79- expect ( Defaults . getHost ( normalisedOptions , 'rest.ably.io' , false ) ) . to . deep . equal ( 'rest.ably.io' ) ;
80- expect ( Defaults . getHost ( normalisedOptions , 'rest.ably.io' , true ) ) . to . deep . equal ( 'realtime.ably.io' ) ;
81+ expect ( Defaults . getHost ( normalisedOptions , 'main.realtime.ably.net' , false ) ) . to . deep . equal (
82+ 'main.realtime.ably.net' ,
83+ ) ;
84+ expect ( Defaults . getHost ( normalisedOptions , 'main.realtime.ably.net' , true ) ) . to . deep . equal (
85+ 'main.realtime.ably.net' ,
86+ ) ;
8187
8288 helper . recordPrivateApi ( 'call.Defaults.getPort' ) ;
8389 expect ( Defaults . getPort ( normalisedOptions ) ) . to . equal ( 443 ) ;
@@ -101,22 +107,26 @@ define(['ably', 'chai'], function (Ably, chai) {
101107 const helper = this . test . helper ;
102108
103109 helper . recordPrivateApi ( 'call.Defaults.normaliseOptions' ) ;
104- var normalisedOptions = Defaults . normaliseOptions ( { environment : 'sandbox' } , null , null ) ;
110+ var normalisedOptions = Defaults . normaliseOptions ( { environment : 'nonprod: sandbox' } , null , null ) ;
105111
106- expect ( normalisedOptions . restHost ) . to . equal ( 'sandbox-rest. ably.io ' ) ;
107- expect ( normalisedOptions . realtimeHost ) . to . equal ( 'sandbox- realtime.ably.io ' ) ;
112+ expect ( normalisedOptions . restHost ) . to . equal ( 'sandbox.realtime. ably-nonprod.net ' ) ;
113+ expect ( normalisedOptions . realtimeHost ) . to . equal ( 'sandbox. realtime.ably-nonprod.net ' ) ;
108114 expect ( normalisedOptions . port ) . to . equal ( 80 ) ;
109115 expect ( normalisedOptions . tlsPort ) . to . equal ( 443 ) ;
110- expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal ( Defaults . environmentFallbackHosts ( 'sandbox' ) . sort ( ) ) ;
116+ expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal (
117+ Defaults . getEndpointFallbackHosts ( 'nonprod:sandbox' ) . sort ( ) ,
118+ ) ;
111119 expect ( normalisedOptions . tls ) . to . equal ( true ) ;
112120
113121 helper . recordPrivateApi ( 'call.Defaults.getHosts' ) ;
114122 expect ( Defaults . getHosts ( normalisedOptions ) . length ) . to . deep . equal ( 4 ) ;
115123 expect ( Defaults . getHosts ( normalisedOptions ) [ 0 ] ) . to . deep . equal ( normalisedOptions . restHost ) ;
116124 helper . recordPrivateApi ( 'call.Defaults.getHost' ) ;
117- expect ( Defaults . getHost ( normalisedOptions , 'sandbox-rest.ably.io' , false ) ) . to . deep . equal ( 'sandbox-rest.ably.io' ) ;
118- expect ( Defaults . getHost ( normalisedOptions , 'sandbox-rest.ably.io' , true ) ) . to . deep . equal (
119- 'sandbox-realtime.ably.io' ,
125+ expect ( Defaults . getHost ( normalisedOptions , 'sandbox.realtime.ably-nonprod.net' , false ) ) . to . deep . equal (
126+ 'sandbox.realtime.ably-nonprod.net' ,
127+ ) ;
128+ expect ( Defaults . getHost ( normalisedOptions , 'sandbox.realtime.ably-nonprod.net' , true ) ) . to . deep . equal (
129+ 'sandbox.realtime.ably-nonprod.net' ,
120130 ) ;
121131
122132 helper . recordPrivateApi ( 'call.Defaults.getPort' ) ;
@@ -147,8 +157,8 @@ define(['ably', 'chai'], function (Ably, chai) {
147157 null ,
148158 ) ;
149159
150- expect ( normalisedOptions . restHost ) . to . equal ( 'local-rest. ably.io ' ) ;
151- expect ( normalisedOptions . realtimeHost ) . to . equal ( 'local- realtime.ably.io ' ) ;
160+ expect ( normalisedOptions . restHost ) . to . equal ( 'local.realtime. ably.net ' ) ;
161+ expect ( normalisedOptions . realtimeHost ) . to . equal ( 'local. realtime.ably.net ' ) ;
152162 expect ( normalisedOptions . port ) . to . equal ( 8080 ) ;
153163 expect ( normalisedOptions . tlsPort ) . to . equal ( 8081 ) ;
154164 expect ( normalisedOptions . fallbackHosts ) . to . equal ( undefined ) ;
@@ -157,8 +167,12 @@ define(['ably', 'chai'], function (Ably, chai) {
157167 helper . recordPrivateApi ( 'call.Defaults.getHosts' ) ;
158168 expect ( Defaults . getHosts ( normalisedOptions ) ) . to . deep . equal ( [ normalisedOptions . restHost ] ) ;
159169 helper . recordPrivateApi ( 'call.Defaults.getHost' ) ;
160- expect ( Defaults . getHost ( normalisedOptions , 'local-rest.ably.io' , false ) ) . to . deep . equal ( 'local-rest.ably.io' ) ;
161- expect ( Defaults . getHost ( normalisedOptions , 'local-rest.ably.io' , true ) ) . to . deep . equal ( 'local-realtime.ably.io' ) ;
170+ expect ( Defaults . getHost ( normalisedOptions , 'local.realtime.ably.net' , false ) ) . to . deep . equal (
171+ 'local.realtime.ably.net' ,
172+ ) ;
173+ expect ( Defaults . getHost ( normalisedOptions , 'local.realtime.ably.net' , true ) ) . to . deep . equal (
174+ 'local.realtime.ably.net' ,
175+ ) ;
162176
163177 helper . recordPrivateApi ( 'call.Defaults.getPort' ) ;
164178 expect ( Defaults . getPort ( normalisedOptions ) ) . to . equal ( 8081 ) ;
@@ -255,24 +269,28 @@ define(['ably', 'chai'], function (Ably, chai) {
255269 const helper = this . test . helper ;
256270
257271 helper . recordPrivateApi ( 'write.Defaults.ENVIRONMENT' ) ;
258- Defaults . ENVIRONMENT = 'sandbox' ;
272+ Defaults . ENVIRONMENT = 'nonprod: sandbox' ;
259273 helper . recordPrivateApi ( 'call.Defaults.normaliseOptions' ) ;
260274 var normalisedOptions = Defaults . normaliseOptions ( { } , null , null ) ;
261275
262- expect ( normalisedOptions . restHost ) . to . equal ( 'sandbox-rest. ably.io ' ) ;
263- expect ( normalisedOptions . realtimeHost ) . to . equal ( 'sandbox- realtime.ably.io ' ) ;
276+ expect ( normalisedOptions . restHost ) . to . equal ( 'sandbox.realtime. ably-nonprod.net ' ) ;
277+ expect ( normalisedOptions . realtimeHost ) . to . equal ( 'sandbox. realtime.ably-nonprod.net ' ) ;
264278 expect ( normalisedOptions . port ) . to . equal ( 80 ) ;
265279 expect ( normalisedOptions . tlsPort ) . to . equal ( 443 ) ;
266- expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal ( Defaults . environmentFallbackHosts ( 'sandbox' ) . sort ( ) ) ;
280+ expect ( normalisedOptions . fallbackHosts . sort ( ) ) . to . deep . equal (
281+ Defaults . getEndpointFallbackHosts ( 'nonprod:sandbox' ) . sort ( ) ,
282+ ) ;
267283 expect ( normalisedOptions . tls ) . to . equal ( true ) ;
268284
269285 helper . recordPrivateApi ( 'call.Defaults.getHosts' ) ;
270286 expect ( Defaults . getHosts ( normalisedOptions ) . length ) . to . equal ( 4 ) ;
271287 expect ( Defaults . getHosts ( normalisedOptions ) [ 0 ] ) . to . deep . equal ( normalisedOptions . restHost ) ;
272288 helper . recordPrivateApi ( 'call.Defaults.getHost' ) ;
273- expect ( Defaults . getHost ( normalisedOptions , 'sandbox-rest.ably.io' , false ) ) . to . deep . equal ( 'sandbox-rest.ably.io' ) ;
274- expect ( Defaults . getHost ( normalisedOptions , 'sandbox-rest.ably.io' , true ) ) . to . deep . equal (
275- 'sandbox-realtime.ably.io' ,
289+ expect ( Defaults . getHost ( normalisedOptions , 'sandbox.realtime.ably-nonprod.net' , false ) ) . to . deep . equal (
290+ 'sandbox.realtime.ably-nonprod.net' ,
291+ ) ;
292+ expect ( Defaults . getHost ( normalisedOptions , 'sandbox.realtime.ably-nonprod.net' , true ) ) . to . deep . equal (
293+ 'sandbox.realtime.ably-nonprod.net' ,
276294 ) ;
277295
278296 helper . recordPrivateApi ( 'call.Defaults.getPort' ) ;
0 commit comments