You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should configure endpoints for NA region',done=>{
173
+
varaxiosInstance=contentstackHTTPClient({
174
+
apiKey: 'apiKey',
175
+
accessToken: 'accessToken',
176
+
defaultHostName: 'api.contentstack.io',
177
+
region: 'na'
178
+
})
179
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://app.contentstack.com','NA UI base URL should match')
180
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('developerhub-api.contentstack.com','NA developer hub should match')
181
+
done()
182
+
})
183
+
184
+
it('should configure endpoints for EU region',done=>{
185
+
varaxiosInstance=contentstackHTTPClient({
186
+
apiKey: 'apiKey',
187
+
accessToken: 'accessToken',
188
+
defaultHostName: 'eu-api.contentstack.com',
189
+
region: 'eu'
190
+
})
191
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://eu-app.contentstack.com','EU UI base URL should match')
192
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('eu-developerhub-api.contentstack.com','EU developer hub should match')
193
+
done()
194
+
})
195
+
196
+
it('should configure endpoints for AU region',done=>{
197
+
varaxiosInstance=contentstackHTTPClient({
198
+
apiKey: 'apiKey',
199
+
accessToken: 'accessToken',
200
+
defaultHostName: 'au-api.contentstack.com',
201
+
region: 'au'
202
+
})
203
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://au-app.contentstack.com','AU UI base URL should match')
204
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('au-developerhub-api.contentstack.com','AU developer hub should match')
205
+
done()
206
+
})
207
+
208
+
it('should configure endpoints for Azure NA region',done=>{
209
+
varaxiosInstance=contentstackHTTPClient({
210
+
apiKey: 'apiKey',
211
+
accessToken: 'accessToken',
212
+
defaultHostName: 'azure-na-api.contentstack.com',
213
+
region: 'azure-na'
214
+
})
215
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://azure-na-app.contentstack.com','Azure NA UI base URL should match')
216
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('azure-na-developerhub-api.contentstack.com','Azure NA developer hub should match')
217
+
done()
218
+
})
219
+
220
+
it('should configure endpoints for Azure EU region',done=>{
221
+
varaxiosInstance=contentstackHTTPClient({
222
+
apiKey: 'apiKey',
223
+
accessToken: 'accessToken',
224
+
defaultHostName: 'azure-eu-api.contentstack.com',
225
+
region: 'azure-eu'
226
+
})
227
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://azure-eu-app.contentstack.com','Azure EU UI base URL should match')
228
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('azure-eu-developerhub-api.contentstack.com','Azure EU developer hub should match')
229
+
done()
230
+
})
231
+
232
+
it('should configure endpoints for GCP NA region',done=>{
233
+
varaxiosInstance=contentstackHTTPClient({
234
+
apiKey: 'apiKey',
235
+
accessToken: 'accessToken',
236
+
defaultHostName: 'gcp-na-api.contentstack.com',
237
+
region: 'gcp-na'
238
+
})
239
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://gcp-na-app.contentstack.com','GCP NA UI base URL should match')
240
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('gcp-na-developerhub-api.contentstack.com','GCP NA developer hub should match')
241
+
done()
242
+
})
243
+
244
+
it('should configure endpoints for GCP EU region',done=>{
245
+
varaxiosInstance=contentstackHTTPClient({
246
+
apiKey: 'apiKey',
247
+
accessToken: 'accessToken',
248
+
defaultHostName: 'gcp-eu-api.contentstack.com',
249
+
region: 'gcp-eu'
250
+
})
251
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://gcp-eu-app.contentstack.com','GCP EU UI base URL should match')
252
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('gcp-eu-developerhub-api.contentstack.com','GCP EU developer hub should match')
253
+
done()
254
+
})
255
+
256
+
it('should include https protocol in developer hub base URL',done=>{
257
+
varaxiosInstance=contentstackHTTPClient({
258
+
apiKey: 'apiKey',
259
+
accessToken: 'accessToken',
260
+
defaultHostName: 'api.contentstack.io',
261
+
region: 'na'
262
+
})
263
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.match(/^https:\/\//,'Developer hub URL should start with https://')
264
+
done()
265
+
})
266
+
267
+
it('should include https protocol in UI base URL',done=>{
268
+
varaxiosInstance=contentstackHTTPClient({
269
+
apiKey: 'apiKey',
270
+
accessToken: 'accessToken',
271
+
defaultHostName: 'api.contentstack.io',
272
+
region: 'na'
273
+
})
274
+
expect(axiosInstance.defaults.uiBaseUrl).to.match(/^https:\/\//,'UI base URL should start with https://')
275
+
done()
276
+
})
277
+
278
+
it('should configure UI base URL with protocol for NA region',done=>{
279
+
varaxiosInstance=contentstackHTTPClient({
280
+
apiKey: 'apiKey',
281
+
accessToken: 'accessToken',
282
+
defaultHostName: 'api.contentstack.io',
283
+
region: 'na'
284
+
})
285
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://app.contentstack.com','NA UI base URL should include protocol')
286
+
done()
287
+
})
288
+
289
+
it('should configure UI base URL with protocol for EU region',done=>{
290
+
varaxiosInstance=contentstackHTTPClient({
291
+
apiKey: 'apiKey',
292
+
accessToken: 'accessToken',
293
+
defaultHostName: 'eu-api.contentstack.com',
294
+
region: 'eu'
295
+
})
296
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://eu-app.contentstack.com','EU UI base URL should include protocol')
297
+
done()
298
+
})
299
+
300
+
it('should handle region aliases when configuring endpoints',done=>{
301
+
varaxiosInstance=contentstackHTTPClient({
302
+
apiKey: 'apiKey',
303
+
accessToken: 'accessToken',
304
+
defaultHostName: 'api.contentstack.io',
305
+
region: 'us'
306
+
})
307
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://app.contentstack.com','US alias should map to NA endpoints')
308
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('developerhub-api.contentstack.com','US alias should map to NA developer hub')
309
+
done()
310
+
})
311
+
312
+
it('should handle azure_na alias when configuring endpoints',done=>{
313
+
varaxiosInstance=contentstackHTTPClient({
314
+
apiKey: 'apiKey',
315
+
accessToken: 'accessToken',
316
+
defaultHostName: 'azure-na-api.contentstack.com',
317
+
region: 'azure_na'
318
+
})
319
+
expect(axiosInstance.defaults.uiBaseUrl).to.be.equal('https://azure-na-app.contentstack.com','azure_na alias should work')
320
+
expect(axiosInstance.defaults.developerHubBaseUrl).to.contain('azure-na-developerhub-api.contentstack.com','azure_na alias should work for developer hub')
321
+
done()
322
+
})
323
+
324
+
it('should configure region property in config',done=>{
325
+
varaxiosInstance=contentstackHTTPClient({
326
+
apiKey: 'apiKey',
327
+
accessToken: 'accessToken',
328
+
defaultHostName: 'api.contentstack.io',
329
+
region: 'eu'
330
+
})
331
+
expect(axiosInstance.defaults.region).to.be.equal('eu','Region should be stored in defaults')
0 commit comments