@webex/plugin-meetings 3.0.0-beta.236 → 3.0.0-beta.237

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.
@@ -8,6 +8,7 @@ import {ROAP} from '../constants';
8
8
 
9
9
  import RoapRequest from './request';
10
10
  import Meeting from '../meeting';
11
+ import MeetingUtil from '../meeting/util';
11
12
 
12
13
  const TURN_DISCOVERY_TIMEOUT = 10; // in seconds
13
14
 
@@ -183,7 +184,7 @@ export default class TurnDiscovery {
183
184
  meetingId: meeting.id,
184
185
  locusMediaRequest: meeting.locusMediaRequest,
185
186
  // @ts-ignore - because of meeting.webex
186
- ipVersion: meeting.webex.meetings.reachability.getIpVersion(),
187
+ ipVersion: MeetingUtil.getIpVersion(meeting.webex),
187
188
  })
188
189
  .then(({mediaConnections}) => {
189
190
  if (mediaConnections) {
@@ -1649,6 +1649,8 @@ describe('plugin-meetings', () => {
1649
1649
  beforeEach(() => {
1650
1650
  clock = sinon.useFakeTimers();
1651
1651
 
1652
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
1653
+
1652
1654
  meeting.deviceUrl = 'deviceUrl';
1653
1655
  meeting.config.deviceType = 'web';
1654
1656
  meeting.isMultistream = isMultistream;
@@ -1662,7 +1664,6 @@ describe('plugin-meetings', () => {
1662
1664
  meeting.webex.meetings.geoHintInfo = {regionCode: 'EU', countryCode: 'UK'};
1663
1665
  meeting.webex.meetings.reachability = {
1664
1666
  isAnyClusterReachable: sinon.stub().resolves(true),
1665
- getIpVersion: () => IP_VERSION.unknown,
1666
1667
  };
1667
1668
  meeting.roap.doTurnDiscovery = sinon
1668
1669
  .stub()
@@ -1739,6 +1740,7 @@ describe('plugin-meetings', () => {
1739
1740
 
1740
1741
  afterEach(() => {
1741
1742
  clock.restore();
1743
+ sinon.restore();
1742
1744
  });
1743
1745
 
1744
1746
  // helper function that waits until all promises are resolved and any queued up /media requests to Locus are sent out
@@ -4,10 +4,9 @@ import Meetings from '@webex/plugin-meetings';
4
4
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
5
5
  import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
6
6
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
7
- import Metrics from '@webex/plugin-meetings/src/metrics/index';
8
- import {SELF_POLICY} from '@webex/plugin-meetings/src/constants';
9
- import {DISPLAY_HINTS} from '@webex/plugin-meetings/src/constants';
7
+ import {SELF_POLICY, IP_VERSION} from '@webex/plugin-meetings/src/constants';
10
8
  import MockWebex from '@webex/test-helper-mock-webex';
9
+ import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/browser-detection';
11
10
 
12
11
  describe('plugin-meetings', () => {
13
12
  let webex;
@@ -984,5 +983,56 @@ describe('plugin-meetings', () => {
984
983
  assert.equal(result, input);
985
984
  });
986
985
  });
986
+
987
+ describe('getIpVersion', () => {
988
+ let isBrowserStub;
989
+ beforeEach(() => {
990
+ isBrowserStub = sinon.stub().returns(false);
991
+
992
+ sinon.stub(BrowserDetectionModule, 'default').returns({
993
+ isBrowser: isBrowserStub,
994
+ });
995
+ });
996
+
997
+ afterEach(() => {
998
+ sinon.restore();
999
+ });
1000
+
1001
+ [
1002
+ {supportsIpV4: undefined, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1003
+ {supportsIpV4: undefined, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1004
+ {supportsIpV4: undefined, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1005
+ {supportsIpV4: true, supportsIpV6: undefined, expectedOutput: IP_VERSION.only_ipv4},
1006
+ {supportsIpV4: true, supportsIpV6: true, expectedOutput: IP_VERSION.ipv4_and_ipv6},
1007
+ {supportsIpV4: true, supportsIpV6: false, expectedOutput: IP_VERSION.only_ipv4},
1008
+ {supportsIpV4: false, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1009
+ {supportsIpV4: false, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1010
+ {supportsIpV4: false, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1011
+ ].forEach(({supportsIpV4, supportsIpV6, expectedOutput}) => {
1012
+ it(`returns ${expectedOutput} when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6}`, () => {
1013
+ sinon
1014
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1015
+ .get(() => supportsIpV4);
1016
+ sinon
1017
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1018
+ .get(() => supportsIpV6);
1019
+
1020
+ assert.equal(MeetingUtil.getIpVersion(webex), expectedOutput);
1021
+ });
1022
+
1023
+ it(`returns undefined when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6} and browser is firefox`, () => {
1024
+ sinon
1025
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1026
+ .get(() => supportsIpV4);
1027
+ sinon
1028
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1029
+ .get(() => supportsIpV6);
1030
+
1031
+ isBrowserStub.callsFake((name) => name === 'firefox');
1032
+
1033
+ assert.equal(MeetingUtil.getIpVersion(webex), undefined);
1034
+ });
1035
+ });
1036
+ });
987
1037
  });
988
1038
  });
@@ -2,6 +2,8 @@ import {assert} from '@webex/test-helper-chai';
2
2
  import MockWebex from '@webex/test-helper-mock-webex';
3
3
  import sinon from 'sinon';
4
4
  import Reachability, {ICECandidateResult} from '@webex/plugin-meetings/src/reachability/';
5
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
6
+
5
7
  import { IP_VERSION } from '@webex/plugin-meetings/src/constants';
6
8
 
7
9
  describe('isAnyClusterReachable', () => {
@@ -9,6 +11,12 @@ describe('isAnyClusterReachable', () => {
9
11
 
10
12
  beforeEach(() => {
11
13
  webex = new MockWebex();
14
+
15
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
16
+ });
17
+
18
+ afterEach(() => {
19
+ sinon.restore();
12
20
  });
13
21
 
14
22
  const checkIsClusterReachable = async (mockStorage: any, expectedValue: boolean) => {
@@ -251,12 +259,4 @@ describe('gatherReachability', () => {
251
259
  });
252
260
  });
253
261
  });
254
-
255
- describe('getIpVersion', () => {
256
- it('returns unknown', () => {
257
- const reachability = new Reachability(webex);
258
-
259
- assert.equal(reachability.getIpVersion(), IP_VERSION.unknown);
260
- })
261
- })
262
262
  });
@@ -6,6 +6,8 @@ import MockWebex from '@webex/test-helper-mock-webex';
6
6
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
7
7
  import Roap from '@webex/plugin-meetings/src/roap/';
8
8
  import Meeting from '@webex/plugin-meetings/src/meeting';
9
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
10
+
9
11
  import { IP_VERSION } from '../../../../src/constants';
10
12
 
11
13
  describe('Roap', () => {
@@ -62,9 +64,11 @@ describe('Roap', () => {
62
64
  setRoapSeq: sinon.stub(),
63
65
  config: {experimental: {enableTurnDiscovery: false}},
64
66
  locusMediaRequest: {fake: true},
65
- webex: { meetings: { reachability: { isAnyClusterReachable: () => true, getIpVersion: () => IP_VERSION.unknown}}},
67
+ webex: { meetings: { reachability: { isAnyClusterReachable: () => true}}},
66
68
  };
67
69
 
70
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
71
+
68
72
  sendRoapStub = sinon.stub(RoapRequest.prototype, 'sendRoap').resolves({});
69
73
  meeting.setRoapSeq.resetHistory();
70
74
  });
@@ -5,6 +5,7 @@ import TurnDiscovery from '@webex/plugin-meetings/src/roap/turnDiscovery';
5
5
  import Metrics from '@webex/plugin-meetings/src/metrics';
6
6
  import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
7
7
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
8
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
8
9
 
9
10
  import testUtils from '../../../utils/testUtils';
10
11
  import { IP_VERSION } from '../../../../src/constants';
@@ -24,6 +25,7 @@ describe('TurnDiscovery', () => {
24
25
  clock = sinon.useFakeTimers();
25
26
 
26
27
  sinon.stub(Metrics, 'sendBehavioralMetric');
28
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
27
29
 
28
30
  mockRoapRequest = {
29
31
  sendRoap: sinon.fake.resolves({mediaConnections: FAKE_MEDIA_CONNECTIONS_FROM_LOCUS}),
@@ -53,7 +55,6 @@ describe('TurnDiscovery', () => {
53
55
  updateMediaConnections: sinon.stub(),
54
56
  webex: {meetings: {reachability: {
55
57
  isAnyClusterReachable: () => Promise.resolve(false),
56
- getIpVersion: () => IP_VERSION.unknown,
57
58
  }}},
58
59
  isMultistream: false,
59
60
  locusMediaRequest: { fake: true },