@webex/plugin-meetings 3.12.0-next.83 → 3.12.0-next.85

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.
@@ -1,5 +1,12 @@
1
1
  import { IP_VERSION, Enum } from '../constants';
2
2
  export type Protocol = 'udp' | 'tcp' | 'xtls';
3
+ export type ResolvedReachabilityProtocols = {
4
+ udp: boolean;
5
+ tcp: boolean;
6
+ tls: boolean;
7
+ };
8
+ export type ReachabilityProtocolConfig = Partial<Omit<ResolvedReachabilityProtocols, 'udp'>>;
9
+ export type EnableReachabilityChecksConfig = boolean | ReachabilityProtocolConfig;
3
10
  /**
4
11
  * Events emitted by ReachabilityPeerConnection
5
12
  */
@@ -1,3 +1,20 @@
1
+ import { EnableReachabilityChecksConfig, ResolvedReachabilityProtocols } from './reachability.types';
2
+ /**
3
+ * Resolves `enableReachabilityChecks` into explicit per-protocol flags.
4
+ * Defaults to all protocols enabled when not configured.
5
+ * UDP is always tested unless reachability is disabled entirely (`false`).
6
+ *
7
+ * @param {EnableReachabilityChecksConfig} enabled value of config.meetings.enableReachabilityChecks
8
+ * @returns {ResolvedReachabilityProtocols} resolved per-protocol flags
9
+ */
10
+ export declare function resolveReachabilityProtocols(enabled?: EnableReachabilityChecksConfig): ResolvedReachabilityProtocols;
11
+ /**
12
+ * Whether any reachability protocol is enabled.
13
+ *
14
+ * @param {EnableReachabilityChecksConfig} config value of config.meetings.enableReachabilityChecks
15
+ * @returns {boolean} true if any protocol is enabled
16
+ */
17
+ export declare function isReachabilityEnabled(config?: EnableReachabilityChecksConfig): boolean;
1
18
  /**
2
19
  * Converts a stun url to a turn url
3
20
  *
@@ -869,7 +869,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
869
869
  }, _callee1);
870
870
  }))();
871
871
  },
872
- version: "3.12.0-next.83"
872
+ version: "3.12.0-next.85"
873
873
  });
874
874
  var _default = exports.default = Webinar;
875
875
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -44,12 +44,12 @@
44
44
  "@webex/event-dictionary-ts": "^1.0.2181",
45
45
  "@webex/jest-config-legacy": "0.0.0",
46
46
  "@webex/legacy-tools": "0.0.0",
47
- "@webex/plugin-rooms": "3.12.0-next.27",
48
- "@webex/test-helper-chai": "3.12.0-next.4",
49
- "@webex/test-helper-mocha": "3.12.0-next.4",
50
- "@webex/test-helper-mock-webex": "3.12.0-next.4",
51
- "@webex/test-helper-retry": "3.12.0-next.4",
52
- "@webex/test-helper-test-users": "3.12.0-next.4",
47
+ "@webex/plugin-rooms": "3.12.0-next.28",
48
+ "@webex/test-helper-chai": "3.12.0-next.5",
49
+ "@webex/test-helper-mocha": "3.12.0-next.5",
50
+ "@webex/test-helper-mock-webex": "3.12.0-next.5",
51
+ "@webex/test-helper-retry": "3.12.0-next.5",
52
+ "@webex/test-helper-test-users": "3.12.0-next.5",
53
53
  "chai": "^4.3.4",
54
54
  "chai-as-promised": "^7.1.1",
55
55
  "eslint": "^8.24.0",
@@ -61,22 +61,22 @@
61
61
  "typescript": "^4.7.4"
62
62
  },
63
63
  "dependencies": {
64
- "@webex/common": "3.12.0-next.4",
64
+ "@webex/common": "3.12.0-next.5",
65
65
  "@webex/internal-media-core": "2.26.1",
66
- "@webex/internal-plugin-conversation": "3.12.0-next.27",
67
- "@webex/internal-plugin-device": "3.12.0-next.25",
68
- "@webex/internal-plugin-llm": "3.12.0-next.29",
69
- "@webex/internal-plugin-mercury": "3.12.0-next.26",
70
- "@webex/internal-plugin-metrics": "3.12.0-next.25",
71
- "@webex/internal-plugin-support": "3.12.0-next.27",
72
- "@webex/internal-plugin-user": "3.12.0-next.26",
73
- "@webex/internal-plugin-voicea": "3.12.0-next.29",
74
- "@webex/media-helpers": "3.12.0-next.8",
75
- "@webex/plugin-people": "3.12.0-next.26",
76
- "@webex/plugin-rooms": "3.12.0-next.27",
66
+ "@webex/internal-plugin-conversation": "3.12.0-next.28",
67
+ "@webex/internal-plugin-device": "3.12.0-next.26",
68
+ "@webex/internal-plugin-llm": "3.12.0-next.30",
69
+ "@webex/internal-plugin-mercury": "3.12.0-next.27",
70
+ "@webex/internal-plugin-metrics": "3.12.0-next.26",
71
+ "@webex/internal-plugin-support": "3.12.0-next.28",
72
+ "@webex/internal-plugin-user": "3.12.0-next.27",
73
+ "@webex/internal-plugin-voicea": "3.12.0-next.30",
74
+ "@webex/media-helpers": "3.12.0-next.9",
75
+ "@webex/plugin-people": "3.12.0-next.27",
76
+ "@webex/plugin-rooms": "3.12.0-next.28",
77
77
  "@webex/ts-sdp": "^1.8.1",
78
78
  "@webex/web-capabilities": "^1.10.0",
79
- "@webex/webex-core": "3.12.0-next.25",
79
+ "@webex/webex-core": "3.12.0-next.26",
80
80
  "ampersand-collection": "^2.0.2",
81
81
  "bowser": "^2.11.0",
82
82
  "btoa": "^1.2.1",
@@ -94,5 +94,5 @@
94
94
  "//": [
95
95
  "TODO: upgrade jwt-decode when moving to node 18"
96
96
  ],
97
- "version": "3.12.0-next.83"
97
+ "version": "3.12.0-next.85"
98
98
  }
package/src/config.ts CHANGED
@@ -87,8 +87,6 @@ export default {
87
87
  enableMediaNegotiatedEvent: false,
88
88
  enableUnifiedMeetings: true,
89
89
  enableAdhocMeetings: true,
90
- enableTcpReachability: false,
91
- enableTlsReachability: false,
92
90
  storeLocusHashTreeEventsForDebugging: false,
93
91
  },
94
92
  degradationPreferences: {
@@ -840,42 +840,6 @@ export default class Meetings extends WebexPlugin {
840
840
  }
841
841
  }
842
842
 
843
- /**
844
- * API to toggle TCP reachability, needs to be called before webex.meetings.register()
845
- * @param {Boolean} newValue
846
- * @private
847
- * @memberof Meetings
848
- * @returns {undefined}
849
- */
850
- private _toggleTcpReachability(newValue: boolean) {
851
- if (typeof newValue !== 'boolean') {
852
- return;
853
- }
854
- // @ts-ignore
855
- if (this.config.experimental.enableTcpReachability !== newValue) {
856
- // @ts-ignore
857
- this.config.experimental.enableTcpReachability = newValue;
858
- }
859
- }
860
-
861
- /**
862
- * API to toggle TLS reachability, needs to be called before webex.meetings.register()
863
- * @param {Boolean} newValue
864
- * @private
865
- * @memberof Meetings
866
- * @returns {undefined}
867
- */
868
- private _toggleTlsReachability(newValue: boolean) {
869
- if (typeof newValue !== 'boolean') {
870
- return;
871
- }
872
- // @ts-ignore
873
- if (this.config.experimental.enableTlsReachability !== newValue) {
874
- // @ts-ignore
875
- this.config.experimental.enableTlsReachability = newValue;
876
- }
877
- }
878
-
879
843
  /**
880
844
  * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
881
845
  *
@@ -33,6 +33,7 @@ import {
33
33
  NatTypeUpdatedEventData,
34
34
  ResultEventData,
35
35
  } from './clusterReachability';
36
+ import {isReachabilityEnabled, resolveReachabilityProtocols} from './util';
36
37
  import EventsScope from '../common/events/events-scope';
37
38
  import BEHAVIORAL_METRICS from '../metrics/constants';
38
39
  import Metrics from '../metrics';
@@ -194,7 +195,7 @@ export default class Reachability extends EventsScope {
194
195
  */
195
196
  public async gatherReachability(trigger: string): Promise<ReachabilityResults> {
196
197
  // @ts-ignore
197
- if (!this.webex.config.meetings.enableReachabilityChecks) {
198
+ if (!isReachabilityEnabled(this.webex.config.meetings.enableReachabilityChecks)) {
198
199
  throw new Error('enableReachabilityChecks is disabled in config');
199
200
  }
200
201
 
@@ -515,7 +516,7 @@ export default class Reachability extends EventsScope {
515
516
  * Returns true only if ALL protocols (UDP, TCP and TLS) have been tested and none
516
517
  * of the media clusters where reachable with any of the protocols. This is done
517
518
  * irrespective of the config, so for example:
518
- * if config.meetings.experimental.enableTlsReachability === false,
519
+ * if config.meetings.enableReachabilityChecks disables TLS,
519
520
  * it will return false, because TLS reachability won't be tested,
520
521
  * so we can't say for sure that media backend is unreachable over TLS.
521
522
  *
@@ -888,14 +889,21 @@ export default class Reachability extends EventsScope {
888
889
 
889
890
  this.startTime = performance.now();
890
891
 
892
+ const protocols = resolveReachabilityProtocols(
893
+ // @ts-ignore
894
+ this.webex.config.meetings.enableReachabilityChecks
895
+ );
896
+
897
+ const enabledProtocols = [
898
+ protocols.udp && 'UDP',
899
+ protocols.tcp && 'TCP',
900
+ protocols.tls && 'TLS',
901
+ ].filter(Boolean);
902
+
891
903
  LoggerProxy.logger.log(
892
- `Reachability:index#performReachabilityChecks --> doing UDP${
893
- // @ts-ignore
894
- this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : ''
895
- }${
896
- // @ts-ignore
897
- this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : ''
898
- } reachability checks`
904
+ `Reachability:index#performReachabilityChecks --> doing ${enabledProtocols.join(
905
+ ','
906
+ )} reachability checks`
899
907
  );
900
908
 
901
909
  this.resetResultCounters();
@@ -905,18 +913,14 @@ export default class Reachability extends EventsScope {
905
913
  const cluster = clusterList[key];
906
914
 
907
915
  // Linus doesn't support TCP reachability checks on video mesh nodes
908
- const includeTcpReachability =
909
- // @ts-ignore
910
- this.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;
916
+ const includeTcpReachability = protocols.tcp && !cluster.isVideoMesh;
911
917
 
912
918
  if (!includeTcpReachability) {
913
919
  cluster.tcp = [];
914
920
  }
915
921
 
916
922
  // Linus doesn't support xTLS reachability checks on video mesh nodes
917
- const includeTlsReachability =
918
- // @ts-ignore
919
- this.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
923
+ const includeTlsReachability = protocols.tls && !cluster.isVideoMesh;
920
924
 
921
925
  if (!includeTlsReachability) {
922
926
  cluster.xtls = [];
@@ -2,6 +2,17 @@ import {IP_VERSION, Enum} from '../constants';
2
2
 
3
3
  export type Protocol = 'udp' | 'tcp' | 'xtls';
4
4
 
5
+ // Per-protocol reachability flags, fully resolved.
6
+ export type ResolvedReachabilityProtocols = {
7
+ udp: boolean;
8
+ tcp: boolean;
9
+ tls: boolean;
10
+ };
11
+
12
+ export type ReachabilityProtocolConfig = Partial<Omit<ResolvedReachabilityProtocols, 'udp'>>;
13
+
14
+ export type EnableReachabilityChecksConfig = boolean | ReachabilityProtocolConfig;
15
+
5
16
  /**
6
17
  * Events emitted by ReachabilityPeerConnection
7
18
  */
@@ -1,4 +1,40 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
+ import {EnableReachabilityChecksConfig, ResolvedReachabilityProtocols} from './reachability.types';
3
+
4
+ /**
5
+ * Resolves `enableReachabilityChecks` into explicit per-protocol flags.
6
+ * Defaults to all protocols enabled when not configured.
7
+ * UDP is always tested unless reachability is disabled entirely (`false`).
8
+ *
9
+ * @param {EnableReachabilityChecksConfig} enabled value of config.meetings.enableReachabilityChecks
10
+ * @returns {ResolvedReachabilityProtocols} resolved per-protocol flags
11
+ */
12
+ export function resolveReachabilityProtocols(
13
+ enabled: EnableReachabilityChecksConfig = true
14
+ ): ResolvedReachabilityProtocols {
15
+ if (typeof enabled === 'object') {
16
+ return {
17
+ udp: true,
18
+ tcp: enabled.tcp ?? true,
19
+ tls: enabled.tls ?? true,
20
+ };
21
+ }
22
+
23
+ return {udp: enabled, tcp: enabled, tls: enabled};
24
+ }
25
+
26
+ /**
27
+ * Whether any reachability protocol is enabled.
28
+ *
29
+ * @param {EnableReachabilityChecksConfig} config value of config.meetings.enableReachabilityChecks
30
+ * @returns {boolean} true if any protocol is enabled
31
+ */
32
+ export function isReachabilityEnabled(config: EnableReachabilityChecksConfig = true): boolean {
33
+ const {udp, tcp, tls} = resolveReachabilityProtocols(config);
34
+
35
+ return udp || tcp || tls;
36
+ }
37
+
2
38
  /**
3
39
  * Converts a stun url to a turn url
4
40
  *
@@ -358,32 +358,6 @@ describe('plugin-meetings', () => {
358
358
  });
359
359
  });
360
360
 
361
- describe('#_toggleTcpReachability', () => {
362
- it('should have _toggleTcpReachability', () => {
363
- assert.equal(typeof webex.meetings._toggleTcpReachability, 'function');
364
- });
365
-
366
- describe('success', () => {
367
- it('should update meetings to do TCP reachability', () => {
368
- webex.meetings._toggleTcpReachability(true);
369
- assert.equal(webex.meetings.config.experimental.enableTcpReachability, true);
370
- });
371
- });
372
- });
373
-
374
- describe('#_toggleTlsReachability', () => {
375
- it('should have _toggleTlsReachability', () => {
376
- assert.equal(typeof webex.meetings._toggleTlsReachability, 'function');
377
- });
378
-
379
- describe('success', () => {
380
- it('should update meetings to do TLS reachability', () => {
381
- webex.meetings._toggleTlsReachability(true);
382
- assert.equal(webex.meetings.config.experimental.enableTlsReachability, true);
383
- });
384
- });
385
- });
386
-
387
361
  describe('#_toggleIpv6BackendNativeSupport', () => {
388
362
  it('should have _toggleIpv6BackendNativeSupport', () => {
389
363
  assert.equal(typeof webex.meetings._toggleIpv6BackendNativeSupport, 'function');
@@ -1,3 +1,4 @@
1
+ import 'jsdom-global/register';
1
2
  import {assert} from '@webex/test-helper-chai';
2
3
  import MockWebex from '@webex/test-helper-mock-webex';
3
4
  import { CapabilityState, WebCapabilities } from '@webex/web-capabilities';
@@ -63,6 +64,13 @@ describe('isAnyPublicClusterReachable', () => {
63
64
  );
64
65
  });
65
66
 
67
+ it('returns false when only xtls is reachable', async () => {
68
+ await checkIsClusterReachable(
69
+ {x: {udp: {result: 'unreachable'}, tcp: {result: 'unreachable'}, xtls: {result: 'reachable'}}},
70
+ false
71
+ );
72
+ });
73
+
66
74
  it('returns false when both tcp and udp are unreachable', async () => {
67
75
  await checkIsClusterReachable(
68
76
  {x: {udp: {result: 'unreachable'}, tcp: {result: 'unreachable'}}},
@@ -70,6 +78,13 @@ describe('isAnyPublicClusterReachable', () => {
70
78
  );
71
79
  });
72
80
 
81
+ it('returns false when udp, tcp and xtls are all unreachable', async () => {
82
+ await checkIsClusterReachable(
83
+ {x: {udp: {result: 'unreachable'}, tcp: {result: 'unreachable'}, xtls: {result: 'unreachable'}}},
84
+ false
85
+ );
86
+ });
87
+
73
88
  it('returns false when reachability result is empty', async () => {
74
89
  await checkIsClusterReachable({x: {}}, false);
75
90
  });
@@ -510,10 +525,7 @@ describe('gatherReachability', () => {
510
525
  return mockInstance;
511
526
  });
512
527
 
513
- webex.config.meetings.experimental = {
514
- enableTcpReachability: false,
515
- enableTlsReachability: false,
516
- };
528
+ webex.config.meetings.enableReachabilityChecks = {tcp: false, tls: false};
517
529
  });
518
530
 
519
531
  afterEach(() => {
@@ -1229,10 +1241,7 @@ describe('gatherReachability', () => {
1229
1241
  expectedMetrics,
1230
1242
  }) =>
1231
1243
  it(`works correctly for the case: ${title}`, async () => {
1232
- webex.config.meetings.experimental = {
1233
- enableTcpReachability: true,
1234
- enableTlsReachability: true,
1235
- };
1244
+ webex.config.meetings.enableReachabilityChecks = true;
1236
1245
 
1237
1246
  // the metrics related to ipver and trigger are not tested in these tests and are all the same, so setting them up here
1238
1247
  const expectedMetricsFull = {
@@ -1367,10 +1376,7 @@ describe('gatherReachability', () => {
1367
1376
  });
1368
1377
 
1369
1378
  it(`starts ip network version detection and includes the results in the metrics`, async () => {
1370
- webex.config.meetings.experimental = {
1371
- enableTcpReachability: true,
1372
- enableTlsReachability: true,
1373
- };
1379
+ webex.config.meetings.enableReachabilityChecks = true;
1374
1380
  webex.internal.device.ipNetworkDetector = {
1375
1381
  supportsIpV4: true,
1376
1382
  supportsIpV6: true,
@@ -1447,10 +1453,7 @@ describe('gatherReachability', () => {
1447
1453
  });
1448
1454
 
1449
1455
  it('keeps updating reachability results after the 3s public cloud timeout expires', async () => {
1450
- webex.config.meetings.experimental = {
1451
- enableTcpReachability: true,
1452
- enableTlsReachability: true,
1453
- };
1456
+ webex.config.meetings.enableReachabilityChecks = true;
1454
1457
 
1455
1458
  const reachability = new Reachability(webex);
1456
1459
 
@@ -1546,10 +1549,7 @@ describe('gatherReachability', () => {
1546
1549
  });
1547
1550
 
1548
1551
  it('handles clientMediaIpsUpdated event by updating clientMediaIps in results', async () => {
1549
- webex.config.meetings.experimental = {
1550
- enableTcpReachability: true,
1551
- enableTlsReachability: true,
1552
- };
1552
+ webex.config.meetings.enableReachabilityChecks = true;
1553
1553
 
1554
1554
  const reachability = new Reachability(webex);
1555
1555
 
@@ -1634,10 +1634,7 @@ describe('gatherReachability', () => {
1634
1634
  });
1635
1635
 
1636
1636
  it('starts ClusterReachability on each media cluster', async () => {
1637
- webex.config.meetings.experimental = {
1638
- enableTcpReachability: true,
1639
- enableTlsReachability: true,
1640
- };
1637
+ webex.config.meetings.enableReachabilityChecks = true;
1641
1638
 
1642
1639
  const getClustersResult = {
1643
1640
  clusters: {
@@ -1686,10 +1683,7 @@ describe('gatherReachability', () => {
1686
1683
  });
1687
1684
 
1688
1685
  it('does not do TCP reachability if it is disabled in config', async () => {
1689
- webex.config.meetings.experimental = {
1690
- enableTcpReachability: false,
1691
- enableTlsReachability: true,
1692
- };
1686
+ webex.config.meetings.enableReachabilityChecks = {tcp: false, tls: true};
1693
1687
 
1694
1688
  const getClustersResult = {
1695
1689
  clusters: {
@@ -1720,10 +1714,7 @@ describe('gatherReachability', () => {
1720
1714
  });
1721
1715
 
1722
1716
  it('does not do TLS reachability if it is disabled in config', async () => {
1723
- webex.config.meetings.experimental = {
1724
- enableTcpReachability: true,
1725
- enableTlsReachability: false,
1726
- };
1717
+ webex.config.meetings.enableReachabilityChecks = {tcp: true, tls: false};
1727
1718
 
1728
1719
  const getClustersResult = {
1729
1720
  clusters: {
@@ -1755,10 +1746,7 @@ describe('gatherReachability', () => {
1755
1746
  });
1756
1747
 
1757
1748
  it('does not do TCP or TLS reachability if it is disabled in config', async () => {
1758
- webex.config.meetings.experimental = {
1759
- enableTcpReachability: false,
1760
- enableTlsReachability: false,
1761
- };
1749
+ webex.config.meetings.enableReachabilityChecks = {tcp: false, tls: false};
1762
1750
 
1763
1751
  const getClustersResult = {
1764
1752
  clusters: {
@@ -1789,12 +1777,40 @@ describe('gatherReachability', () => {
1789
1777
  }, undefined);
1790
1778
  });
1791
1779
 
1792
- it('retry of getClusters is succesfull', async () => {
1793
- webex.config.meetings.experimental = {
1794
- enableTcpReachability: true,
1795
- enableTlsReachability: false,
1780
+ it('does UDP, TCP and TLS reachability by default (enableReachabilityChecks=true)', async () => {
1781
+ webex.config.meetings.enableReachabilityChecks = true;
1782
+
1783
+ const getClustersResult = {
1784
+ clusters: {
1785
+ 'cluster name': {
1786
+ udp: ['testUDP1', 'testUDP2'],
1787
+ tcp: ['testTCP1', 'testTCP2'],
1788
+ xtls: ['testXTLS1', 'testXTLS2'],
1789
+ isVideoMesh: false,
1790
+ },
1791
+ },
1792
+ joinCookie: {id: 'id'},
1796
1793
  };
1797
1794
 
1795
+ const reachability = new Reachability(webex);
1796
+
1797
+ reachability.reachabilityRequest.getClusters = sinon.stub().returns(getClustersResult);
1798
+
1799
+ const promise = reachability.gatherReachability('test');
1800
+ await simulateTimeout();
1801
+ await promise;
1802
+
1803
+ assert.calledOnceWithExactly(clusterReachabilityCtorStub, 'cluster name', {
1804
+ isVideoMesh: false,
1805
+ udp: ['testUDP1', 'testUDP2'],
1806
+ tcp: ['testTCP1', 'testTCP2'],
1807
+ xtls: ['testXTLS1', 'testXTLS2'],
1808
+ }, undefined);
1809
+ });
1810
+
1811
+ it('retry of getClusters is succesfull', async () => {
1812
+ webex.config.meetings.enableReachabilityChecks = {tcp: true, tls: false};
1813
+
1798
1814
  const getClustersResult = {
1799
1815
  clusters: {
1800
1816
  'cluster name': {
@@ -1866,10 +1882,7 @@ describe('gatherReachability', () => {
1866
1882
  };
1867
1883
 
1868
1884
  beforeEach(() => {
1869
- webex.config.meetings.experimental = {
1870
- enableTcpReachability: true,
1871
- enableTlsReachability: true,
1872
- };
1885
+ webex.config.meetings.enableReachabilityChecks = true;
1873
1886
 
1874
1887
  receivedEvents = {
1875
1888
  done: 0,
@@ -2133,7 +2146,7 @@ describe('gatherReachability', () => {
2133
2146
  receivedEvents[event] = receivedEvents[event] + 1 || 1;
2134
2147
  });
2135
2148
  };
2136
-
2149
+
2137
2150
  it('works as expected', async () => {
2138
2151
  setListener('reachability:stopped');
2139
2152
  setListener('reachability:done');
@@ -2948,4 +2961,4 @@ describe('isSubnetReachable', () => {
2948
2961
  it(`returns false if the subnet is unreachable`, () => {
2949
2962
  assert(!reachability.isSubnetReachable('11'));
2950
2963
  });
2951
- });
2964
+ });
@@ -3,9 +3,40 @@ import {assert} from '@webex/test-helper-chai';
3
3
  import {
4
4
  convertStunUrlToTurn,
5
5
  convertStunUrlToTurnTls,
6
+ isReachabilityEnabled,
7
+ resolveReachabilityProtocols,
6
8
  } from '@webex/plugin-meetings/src/reachability/util';
7
9
 
8
10
  describe('plugin-meetings/src/reachability/util', () => {
11
+ describe('#resolveReachabilityProtocols()', () => {
12
+ [
13
+ {title: 'undefined defaults to all enabled', config: undefined, expected: {udp: true, tcp: true, tls: true}},
14
+ {title: 'true enables all protocols', config: true, expected: {udp: true, tcp: true, tls: true}},
15
+ {title: 'false disables all protocols', config: false, expected: {udp: false, tcp: false, tls: false}},
16
+ {title: 'empty object keeps udp on and defaults tcp/tls to enabled', config: {}, expected: {udp: true, tcp: true, tls: true}},
17
+ {title: 'object can disable tcp', config: {tcp: false}, expected: {udp: true, tcp: false, tls: true}},
18
+ {title: 'object can disable tls', config: {tls: false}, expected: {udp: true, tcp: true, tls: false}},
19
+ {title: 'object can disable both tcp and tls but udp stays on', config: {tcp: false, tls: false}, expected: {udp: true, tcp: false, tls: false}},
20
+ ].forEach(({title, config, expected}) => {
21
+ it(`resolves: ${title}`, () => {
22
+ assert.deepEqual(resolveReachabilityProtocols(config as any), expected);
23
+ });
24
+ });
25
+ });
26
+
27
+ describe('#isReachabilityEnabled()', () => {
28
+ [
29
+ {title: 'undefined', config: undefined, expected: true},
30
+ {title: 'true', config: true, expected: true},
31
+ {title: 'false', config: false, expected: false},
32
+ {title: 'object disabling tcp and tls (udp still on)', config: {tcp: false, tls: false}, expected: true},
33
+ ].forEach(({title, config, expected}) => {
34
+ it(`returns ${expected} for ${title}`, () => {
35
+ assert.equal(isReachabilityEnabled(config as any), expected);
36
+ });
37
+ });
38
+ });
39
+
9
40
  describe('#convertStunUrlToTurn()', () => {
10
41
  [
11
42
  {