@webex/webex-core 3.7.0 → 3.8.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -248,6 +248,16 @@ describe('webex-core', () => {
248
248
  });
249
249
 
250
250
  describe('#fetchClientRegionInfo', () => {
251
+ beforeEach(() => {
252
+ services.webex.config = {
253
+ services: {
254
+ discovery: {
255
+ sqdiscovery: 'https://test.ciscospark.com/v1/region',
256
+ },
257
+ }
258
+ };
259
+ });
260
+
251
261
  it('successfully resolves with undefined if fetch request failed', () => {
252
262
  webex.request = sinon.stub().returns(Promise.reject());
253
263
 
@@ -255,6 +265,20 @@ describe('webex-core', () => {
255
265
  assert.isUndefined(r);
256
266
  });
257
267
  });
268
+
269
+ it('successfully resolves with true if fetch request succeeds', () => {
270
+ webex.request = sinon.stub().returns(Promise.resolve({body: true}));
271
+
272
+ return services.fetchClientRegionInfo().then((r) => {
273
+ assert.equal(r, true);
274
+ assert.calledWith(webex.request, {
275
+ uri: 'https://test.ciscospark.com/v1/region',
276
+ addAuthHeader: false,
277
+ headers: { 'spark-user-agent': null },
278
+ timeout: 5000
279
+ });
280
+ });
281
+ });
258
282
  });
259
283
 
260
284
  describe('#getMeetingPreferences', () => {
@@ -288,6 +312,25 @@ describe('webex-core', () => {
288
312
  });
289
313
  });
290
314
 
315
+ describe('#updateCatalog', () => {
316
+ it('updates the catalog', async () => {
317
+ const serviceGroup = 'postauth';
318
+ const hostmap = {hostmap: 'hostmap'};
319
+
320
+ services._formatReceivedHostmap = sinon.stub().returns({some: 'hostmap'});
321
+
322
+ catalog.updateServiceUrls = sinon.stub().returns(Promise.resolve({some: 'value'}));
323
+
324
+ const result = await services.updateCatalog(serviceGroup, hostmap);
325
+
326
+ assert.calledWith(services._formatReceivedHostmap, hostmap);
327
+
328
+ assert.calledWith(catalog.updateServiceUrls, serviceGroup, {some: 'hostmap'});
329
+
330
+ assert.deepEqual(result, {some: 'value'});
331
+ });
332
+ });
333
+
291
334
  describe('#_fetchNewServiceHostmap()', () => {
292
335
 
293
336
  beforeEach(() => {