@webex/calling 3.12.0-next.51 → 3.12.0-next.53
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.
- package/dist/CallingClient/CallingClient.js +25 -78
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +322 -122
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +29 -2
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +88 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +1 -0
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/registration/register.js +10 -0
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +69 -0
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/utils/request.js +20 -0
- package/dist/CallingClient/utils/request.js.map +1 -1
- package/dist/CallingClient/utils/request.test.js +31 -0
- package/dist/CallingClient/utils/request.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/common/Utils.js +18 -7
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +79 -0
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/dist/module/CallingClient/CallingClient.js +17 -39
- package/dist/module/CallingClient/calling/callManager.js +13 -1
- package/dist/module/CallingClient/constants.js +1 -0
- package/dist/module/CallingClient/registration/register.js +3 -0
- package/dist/module/CallingClient/utils/request.js +7 -0
- package/dist/module/common/Utils.js +8 -5
- package/dist/module/index.js +2 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +1 -0
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +1 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/request.d.ts +1 -0
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +26 -25
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,8 @@ var _callManager = require("./calling/callManager");
|
|
|
31
31
|
var _constants = require("./constants");
|
|
32
32
|
var _callRecordFixtures = require("./callRecordFixtures");
|
|
33
33
|
var _callingClientFixtures = require("./callingClientFixtures");
|
|
34
|
-
var _line =
|
|
34
|
+
var _line = _interopRequireWildcard(require("./line"));
|
|
35
|
+
var LineModule = _line;
|
|
35
36
|
var _registerFixtures = require("./registration/registerFixtures");
|
|
36
37
|
var _constants2 = require("../common/constants");
|
|
37
38
|
var _types4 = require("../Metrics/types");
|
|
@@ -648,6 +649,205 @@ describe('CallingClient Tests', function () {
|
|
|
648
649
|
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
649
650
|
});
|
|
650
651
|
});
|
|
652
|
+
describe('createLine transport URI selection', function () {
|
|
653
|
+
var callingClient;
|
|
654
|
+
var lineCtorSpy;
|
|
655
|
+
var primaryHttp = ['https://primary.example.com/api/v1/calling/web/'];
|
|
656
|
+
var backupHttp = ['https://backup.example.com/api/v1/calling/web/'];
|
|
657
|
+
var primaryWss = ['wss://primary.example.com/api/v1/calling/web/'];
|
|
658
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
659
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
660
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
661
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
662
|
+
case 0:
|
|
663
|
+
_context19.next = 1;
|
|
664
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
665
|
+
logger: {
|
|
666
|
+
level: _types.LOGGER.INFO
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
case 1:
|
|
670
|
+
callingClient = _context19.sent;
|
|
671
|
+
callingClient.primaryMobiusUris = primaryHttp;
|
|
672
|
+
callingClient.backupMobiusUris = backupHttp;
|
|
673
|
+
lineCtorSpy = jest.spyOn(LineModule, 'default').mockImplementation(function () {
|
|
674
|
+
return {
|
|
675
|
+
lineId: 'mock-line-id'
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
case 2:
|
|
679
|
+
case "end":
|
|
680
|
+
return _context19.stop();
|
|
681
|
+
}
|
|
682
|
+
}, _callee19);
|
|
683
|
+
})));
|
|
684
|
+
afterEach(function () {
|
|
685
|
+
lineCtorSpy.mockRestore();
|
|
686
|
+
jest.clearAllMocks();
|
|
687
|
+
callingClient.removeAllListeners();
|
|
688
|
+
callManager.removeAllListeners();
|
|
689
|
+
callingClient = undefined;
|
|
690
|
+
});
|
|
691
|
+
var getLineUris = function getLineUris() {
|
|
692
|
+
var ctorArgs = lineCtorSpy.mock.calls[0];
|
|
693
|
+
return {
|
|
694
|
+
primary: ctorArgs[3],
|
|
695
|
+
backup: ctorArgs[4]
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
it('uses normalized WSS URIs for both groups when socket is enabled and WSS URIs are present', function () {
|
|
699
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
700
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
701
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
702
|
+
callingClient['createLine']();
|
|
703
|
+
var _getLineUris = getLineUris(),
|
|
704
|
+
primary = _getLineUris.primary,
|
|
705
|
+
backup = _getLineUris.backup;
|
|
706
|
+
expect(primary).toEqual((0, _Utils.normalizeMobiusUris)(primaryWss));
|
|
707
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
708
|
+
});
|
|
709
|
+
it('falls back to HTTP URIs for a group with no WSS URL even when the socket is enabled', function () {
|
|
710
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
711
|
+
// Primary has no WSS URL (HTTP fallback expected) while backup does.
|
|
712
|
+
callingClient.primaryWssMobiusUris = [];
|
|
713
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
714
|
+
callingClient['createLine']();
|
|
715
|
+
var _getLineUris2 = getLineUris(),
|
|
716
|
+
primary = _getLineUris2.primary,
|
|
717
|
+
backup = _getLineUris2.backup;
|
|
718
|
+
expect(primary).toEqual(primaryHttp);
|
|
719
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
720
|
+
});
|
|
721
|
+
it('uses HTTP URIs for both groups when the socket is enabled but no WSS URLs are present', function () {
|
|
722
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
723
|
+
callingClient.primaryWssMobiusUris = [];
|
|
724
|
+
callingClient.backupWssMobiusUris = [];
|
|
725
|
+
callingClient['createLine']();
|
|
726
|
+
var _getLineUris3 = getLineUris(),
|
|
727
|
+
primary = _getLineUris3.primary,
|
|
728
|
+
backup = _getLineUris3.backup;
|
|
729
|
+
expect(primary).toEqual(primaryHttp);
|
|
730
|
+
expect(backup).toEqual(backupHttp);
|
|
731
|
+
});
|
|
732
|
+
it('uses HTTP URIs for both groups when the socket is disabled', function () {
|
|
733
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(false);
|
|
734
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
735
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
736
|
+
callingClient['createLine']();
|
|
737
|
+
var _getLineUris4 = getLineUris(),
|
|
738
|
+
primary = _getLineUris4.primary,
|
|
739
|
+
backup = _getLineUris4.backup;
|
|
740
|
+
expect(primary).toEqual(primaryHttp);
|
|
741
|
+
expect(backup).toEqual(backupHttp);
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
describe('connectToMobiusSocket', function () {
|
|
745
|
+
var callingClient;
|
|
746
|
+
var connectSpy;
|
|
747
|
+
var primaryWss = ['wss://primary-1.example.com/api/v1/calling/web/', 'wss://primary-2.example.com/api/v1/calling/web/'];
|
|
748
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
749
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
750
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
751
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
_context20.next = 1;
|
|
754
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
755
|
+
logger: {
|
|
756
|
+
level: _types.LOGGER.INFO
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
case 1:
|
|
760
|
+
callingClient = _context20.sent;
|
|
761
|
+
connectSpy = jest.spyOn(callingClient['apiRequest'], 'connectToMobiusSocket');
|
|
762
|
+
warnSpy.mockClear();
|
|
763
|
+
case 2:
|
|
764
|
+
case "end":
|
|
765
|
+
return _context20.stop();
|
|
766
|
+
}
|
|
767
|
+
}, _callee20);
|
|
768
|
+
})));
|
|
769
|
+
afterEach(function () {
|
|
770
|
+
jest.clearAllMocks();
|
|
771
|
+
callingClient.removeAllListeners();
|
|
772
|
+
callManager.removeAllListeners();
|
|
773
|
+
callingClient = undefined;
|
|
774
|
+
});
|
|
775
|
+
it('skips the socket connection and warns when no primary WSS URIs are available', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
776
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
777
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
778
|
+
case 0:
|
|
779
|
+
callingClient.primaryWssMobiusUris = [];
|
|
780
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
781
|
+
_context21.next = 1;
|
|
782
|
+
return callingClient['connectToMobiusSocket']();
|
|
783
|
+
case 1:
|
|
784
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
785
|
+
expect(warnSpy).toHaveBeenCalledWith('No WSS URIs available from Mobius discovery for primary, skipping socket connection', {
|
|
786
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
787
|
+
method: 'connectToMobiusSocket'
|
|
788
|
+
});
|
|
789
|
+
case 2:
|
|
790
|
+
case "end":
|
|
791
|
+
return _context21.stop();
|
|
792
|
+
}
|
|
793
|
+
}, _callee21);
|
|
794
|
+
})));
|
|
795
|
+
it('connects using the first reachable primary WSS URI and stops on success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
796
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
797
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
798
|
+
case 0:
|
|
799
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
800
|
+
connectSpy.mockResolvedValue(undefined);
|
|
801
|
+
_context22.next = 1;
|
|
802
|
+
return callingClient['connectToMobiusSocket']();
|
|
803
|
+
case 1:
|
|
804
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
805
|
+
expect(connectSpy).toHaveBeenCalledWith(primaryWss[0]);
|
|
806
|
+
case 2:
|
|
807
|
+
case "end":
|
|
808
|
+
return _context22.stop();
|
|
809
|
+
}
|
|
810
|
+
}, _callee22);
|
|
811
|
+
})));
|
|
812
|
+
it('tries each primary WSS URI and warns when all attempts fail', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
813
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
814
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
815
|
+
case 0:
|
|
816
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
817
|
+
connectSpy.mockRejectedValue(new Error('connect failed'));
|
|
818
|
+
_context23.next = 1;
|
|
819
|
+
return callingClient['connectToMobiusSocket']();
|
|
820
|
+
case 1:
|
|
821
|
+
expect(connectSpy).toHaveBeenCalledTimes(primaryWss.length);
|
|
822
|
+
expect(connectSpy).toHaveBeenNthCalledWith(1, primaryWss[0]);
|
|
823
|
+
expect(connectSpy).toHaveBeenNthCalledWith(2, primaryWss[1]);
|
|
824
|
+
expect(warnSpy).toHaveBeenCalledWith('All primary WSS URI connection attempts failed', {
|
|
825
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
826
|
+
method: 'connectToMobiusSocket'
|
|
827
|
+
});
|
|
828
|
+
case 2:
|
|
829
|
+
case "end":
|
|
830
|
+
return _context23.stop();
|
|
831
|
+
}
|
|
832
|
+
}, _callee23);
|
|
833
|
+
})));
|
|
834
|
+
it('does not attempt backup WSS URIs when primary WSS URIs are absent', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
835
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
836
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
callingClient.primaryWssMobiusUris = [];
|
|
839
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
840
|
+
_context24.next = 1;
|
|
841
|
+
return callingClient['connectToMobiusSocket']();
|
|
842
|
+
case 1:
|
|
843
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
844
|
+
case 2:
|
|
845
|
+
case "end":
|
|
846
|
+
return _context24.stop();
|
|
847
|
+
}
|
|
848
|
+
}, _callee24);
|
|
849
|
+
})));
|
|
850
|
+
});
|
|
651
851
|
describe('Connectivity and Mercury event handlers', function () {
|
|
652
852
|
var callingClient;
|
|
653
853
|
var line;
|
|
@@ -658,24 +858,24 @@ describe('CallingClient Tests', function () {
|
|
|
658
858
|
var restartRegisterSpy;
|
|
659
859
|
var registerSpy;
|
|
660
860
|
var metricSpy;
|
|
661
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
662
|
-
return _regenerator.default.wrap(function (
|
|
663
|
-
while (1) switch (
|
|
861
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
862
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
863
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
664
864
|
case 0:
|
|
665
865
|
jest.useFakeTimers();
|
|
666
866
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
667
867
|
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
668
|
-
|
|
868
|
+
_context25.next = 1;
|
|
669
869
|
return (0, _CallingClient.createClient)(webex, {
|
|
670
870
|
logger: {
|
|
671
871
|
level: _types.LOGGER.INFO
|
|
672
872
|
}
|
|
673
873
|
});
|
|
674
874
|
case 1:
|
|
675
|
-
callingClient =
|
|
875
|
+
callingClient = _context25.sent;
|
|
676
876
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
677
877
|
reg = line.registration;
|
|
678
|
-
|
|
878
|
+
_context25.next = 2;
|
|
679
879
|
return line.register();
|
|
680
880
|
case 2:
|
|
681
881
|
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
@@ -685,9 +885,9 @@ describe('CallingClient Tests', function () {
|
|
|
685
885
|
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
686
886
|
case 3:
|
|
687
887
|
case "end":
|
|
688
|
-
return
|
|
888
|
+
return _context25.stop();
|
|
689
889
|
}
|
|
690
|
-
},
|
|
890
|
+
}, _callee25);
|
|
691
891
|
})));
|
|
692
892
|
afterEach(function () {
|
|
693
893
|
jest.clearAllTimers();
|
|
@@ -698,16 +898,16 @@ describe('CallingClient Tests', function () {
|
|
|
698
898
|
callingClient = undefined;
|
|
699
899
|
jest.useRealTimers();
|
|
700
900
|
});
|
|
701
|
-
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
901
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
702
902
|
var g, clearKeepaliveSpy, offlineCb;
|
|
703
|
-
return _regenerator.default.wrap(function (
|
|
704
|
-
while (1) switch (
|
|
903
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
904
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
705
905
|
case 0:
|
|
706
906
|
g = global;
|
|
707
907
|
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
708
908
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
709
909
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
710
|
-
|
|
910
|
+
_context26.next = 1;
|
|
711
911
|
return offlineCb();
|
|
712
912
|
case 1:
|
|
713
913
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
@@ -718,20 +918,20 @@ describe('CallingClient Tests', function () {
|
|
|
718
918
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
719
919
|
case 2:
|
|
720
920
|
case "end":
|
|
721
|
-
return
|
|
921
|
+
return _context26.stop();
|
|
722
922
|
}
|
|
723
|
-
},
|
|
923
|
+
}, _callee26);
|
|
724
924
|
})));
|
|
725
|
-
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
925
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
726
926
|
var g, clearKeepaliveSpy, offlineCb;
|
|
727
|
-
return _regenerator.default.wrap(function (
|
|
728
|
-
while (1) switch (
|
|
927
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
928
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
729
929
|
case 0:
|
|
730
930
|
g = global;
|
|
731
931
|
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
732
932
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
733
933
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
734
|
-
|
|
934
|
+
_context27.next = 1;
|
|
735
935
|
return offlineCb();
|
|
736
936
|
case 1:
|
|
737
937
|
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
@@ -739,17 +939,17 @@ describe('CallingClient Tests', function () {
|
|
|
739
939
|
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
740
940
|
case 2:
|
|
741
941
|
case "end":
|
|
742
|
-
return
|
|
942
|
+
return _context27.stop();
|
|
743
943
|
}
|
|
744
|
-
},
|
|
944
|
+
}, _callee27);
|
|
745
945
|
})));
|
|
746
|
-
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
946
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
747
947
|
var onlineCb;
|
|
748
|
-
return _regenerator.default.wrap(function (
|
|
749
|
-
while (1) switch (
|
|
948
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
949
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
750
950
|
case 0:
|
|
751
951
|
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
752
|
-
|
|
952
|
+
_context28.next = 1;
|
|
753
953
|
return onlineCb();
|
|
754
954
|
case 1:
|
|
755
955
|
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
@@ -759,17 +959,17 @@ describe('CallingClient Tests', function () {
|
|
|
759
959
|
});
|
|
760
960
|
case 2:
|
|
761
961
|
case "end":
|
|
762
|
-
return
|
|
962
|
+
return _context28.stop();
|
|
763
963
|
}
|
|
764
|
-
},
|
|
964
|
+
}, _callee28);
|
|
765
965
|
})));
|
|
766
|
-
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
966
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
767
967
|
var mercuryOfflineCb;
|
|
768
|
-
return _regenerator.default.wrap(function (
|
|
769
|
-
while (1) switch (
|
|
968
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
969
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
770
970
|
case 0:
|
|
771
971
|
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
772
|
-
|
|
972
|
+
_context29.next = 1;
|
|
773
973
|
return mercuryOfflineCb();
|
|
774
974
|
case 1:
|
|
775
975
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
@@ -780,26 +980,26 @@ describe('CallingClient Tests', function () {
|
|
|
780
980
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
781
981
|
case 2:
|
|
782
982
|
case "end":
|
|
783
|
-
return
|
|
983
|
+
return _context29.stop();
|
|
784
984
|
}
|
|
785
|
-
},
|
|
985
|
+
}, _callee29);
|
|
786
986
|
})));
|
|
787
|
-
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
987
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
788
988
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
789
|
-
return _regenerator.default.wrap(function (
|
|
790
|
-
while (1) switch (
|
|
989
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
990
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
791
991
|
case 0:
|
|
792
992
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
793
993
|
callingClient['isNetworkDown'] = true;
|
|
794
994
|
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
795
995
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
796
996
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
797
|
-
|
|
997
|
+
_context30.next = 1;
|
|
798
998
|
return mercuryOnlineCb();
|
|
799
999
|
case 1:
|
|
800
1000
|
// Run the interval once
|
|
801
1001
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
802
|
-
|
|
1002
|
+
_context30.next = 2;
|
|
803
1003
|
return flushPromises();
|
|
804
1004
|
case 2:
|
|
805
1005
|
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
@@ -815,14 +1015,14 @@ describe('CallingClient Tests', function () {
|
|
|
815
1015
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
816
1016
|
case 3:
|
|
817
1017
|
case "end":
|
|
818
|
-
return
|
|
1018
|
+
return _context30.stop();
|
|
819
1019
|
}
|
|
820
|
-
},
|
|
1020
|
+
}, _callee30);
|
|
821
1021
|
})));
|
|
822
|
-
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1022
|
+
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
823
1023
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
824
|
-
return _regenerator.default.wrap(function (
|
|
825
|
-
while (1) switch (
|
|
1024
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1025
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
826
1026
|
case 0:
|
|
827
1027
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
828
1028
|
callingClient['isNetworkDown'] = true;
|
|
@@ -830,12 +1030,12 @@ describe('CallingClient Tests', function () {
|
|
|
830
1030
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
831
1031
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
832
1032
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
833
|
-
|
|
1033
|
+
_context31.next = 1;
|
|
834
1034
|
return mercuryOnlineCb();
|
|
835
1035
|
case 1:
|
|
836
1036
|
// Run the interval once
|
|
837
1037
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
838
|
-
|
|
1038
|
+
_context31.next = 2;
|
|
839
1039
|
return flushPromises();
|
|
840
1040
|
case 2:
|
|
841
1041
|
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
@@ -851,14 +1051,14 @@ describe('CallingClient Tests', function () {
|
|
|
851
1051
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
852
1052
|
case 3:
|
|
853
1053
|
case "end":
|
|
854
|
-
return
|
|
1054
|
+
return _context31.stop();
|
|
855
1055
|
}
|
|
856
|
-
},
|
|
1056
|
+
}, _callee31);
|
|
857
1057
|
})));
|
|
858
|
-
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1058
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
859
1059
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
860
|
-
return _regenerator.default.wrap(function (
|
|
861
|
-
while (1) switch (
|
|
1060
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1061
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
862
1062
|
case 0:
|
|
863
1063
|
callingClient['isNetworkDown'] = true;
|
|
864
1064
|
call = callingClient['callManager'].createCall();
|
|
@@ -866,11 +1066,11 @@ describe('CallingClient Tests', function () {
|
|
|
866
1066
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
867
1067
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
868
1068
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
869
|
-
|
|
1069
|
+
_context32.next = 1;
|
|
870
1070
|
return mercuryOnlineCb();
|
|
871
1071
|
case 1:
|
|
872
1072
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
873
|
-
|
|
1073
|
+
_context32.next = 2;
|
|
874
1074
|
return flushPromises();
|
|
875
1075
|
case 2:
|
|
876
1076
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -883,25 +1083,25 @@ describe('CallingClient Tests', function () {
|
|
|
883
1083
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
884
1084
|
case 3:
|
|
885
1085
|
case "end":
|
|
886
|
-
return
|
|
1086
|
+
return _context32.stop();
|
|
887
1087
|
}
|
|
888
|
-
},
|
|
1088
|
+
}, _callee32);
|
|
889
1089
|
})));
|
|
890
|
-
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1090
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
891
1091
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
892
|
-
return _regenerator.default.wrap(function (
|
|
893
|
-
while (1) switch (
|
|
1092
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1093
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
894
1094
|
case 0:
|
|
895
1095
|
call = callingClient['callManager'].createCall();
|
|
896
1096
|
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
897
1097
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
898
1098
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
899
1099
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
900
|
-
|
|
1100
|
+
_context33.next = 1;
|
|
901
1101
|
return mercuryOnlineCb();
|
|
902
1102
|
case 1:
|
|
903
1103
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
904
|
-
|
|
1104
|
+
_context33.next = 2;
|
|
905
1105
|
return flushPromises();
|
|
906
1106
|
case 2:
|
|
907
1107
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -914,9 +1114,9 @@ describe('CallingClient Tests', function () {
|
|
|
914
1114
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
915
1115
|
case 3:
|
|
916
1116
|
case "end":
|
|
917
|
-
return
|
|
1117
|
+
return _context33.stop();
|
|
918
1118
|
}
|
|
919
|
-
},
|
|
1119
|
+
}, _callee33);
|
|
920
1120
|
})));
|
|
921
1121
|
});
|
|
922
1122
|
|
|
@@ -934,15 +1134,15 @@ describe('CallingClient Tests', function () {
|
|
|
934
1134
|
});
|
|
935
1135
|
var callingClient;
|
|
936
1136
|
var line;
|
|
937
|
-
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1137
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
938
1138
|
var calls;
|
|
939
|
-
return _regenerator.default.wrap(function (
|
|
940
|
-
while (1) switch (
|
|
1139
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1140
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
941
1141
|
case 0:
|
|
942
|
-
|
|
1142
|
+
_context34.next = 1;
|
|
943
1143
|
return (0, _CallingClient.createClient)(webex);
|
|
944
1144
|
case 1:
|
|
945
|
-
callingClient =
|
|
1145
|
+
callingClient = _context34.sent;
|
|
946
1146
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
947
1147
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
948
1148
|
calls.forEach(function (call) {
|
|
@@ -950,9 +1150,9 @@ describe('CallingClient Tests', function () {
|
|
|
950
1150
|
});
|
|
951
1151
|
case 2:
|
|
952
1152
|
case "end":
|
|
953
|
-
return
|
|
1153
|
+
return _context34.stop();
|
|
954
1154
|
}
|
|
955
|
-
},
|
|
1155
|
+
}, _callee34);
|
|
956
1156
|
})));
|
|
957
1157
|
afterAll(function () {
|
|
958
1158
|
callingClient.removeAllListeners();
|
|
@@ -1035,23 +1235,23 @@ describe('CallingClient Tests', function () {
|
|
|
1035
1235
|
describe('Call Session Event test', function () {
|
|
1036
1236
|
var mockOn = webex.internal.mercury.on;
|
|
1037
1237
|
var callingClient;
|
|
1038
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1039
|
-
return _regenerator.default.wrap(function (
|
|
1040
|
-
while (1) switch (
|
|
1238
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1239
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1240
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1041
1241
|
case 0:
|
|
1042
|
-
|
|
1242
|
+
_context35.next = 1;
|
|
1043
1243
|
return (0, _CallingClient.createClient)(webex, {
|
|
1044
1244
|
logger: {
|
|
1045
1245
|
level: _types.LOGGER.INFO
|
|
1046
1246
|
}
|
|
1047
1247
|
});
|
|
1048
1248
|
case 1:
|
|
1049
|
-
callingClient =
|
|
1249
|
+
callingClient = _context35.sent;
|
|
1050
1250
|
case 2:
|
|
1051
1251
|
case "end":
|
|
1052
|
-
return
|
|
1252
|
+
return _context35.stop();
|
|
1053
1253
|
}
|
|
1054
|
-
},
|
|
1254
|
+
}, _callee35);
|
|
1055
1255
|
})));
|
|
1056
1256
|
afterEach(function () {
|
|
1057
1257
|
callingClient.removeAllListeners();
|
|
@@ -1082,10 +1282,10 @@ describe('CallingClient Tests', function () {
|
|
|
1082
1282
|
var callingClient;
|
|
1083
1283
|
var asyncEventCallback;
|
|
1084
1284
|
var mobiusSocketMock;
|
|
1085
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1285
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1086
1286
|
var asyncEventOnCall;
|
|
1087
|
-
return _regenerator.default.wrap(function (
|
|
1088
|
-
while (1) switch (
|
|
1287
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1288
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1089
1289
|
case 0:
|
|
1090
1290
|
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1091
1291
|
value: true
|
|
@@ -1097,23 +1297,23 @@ describe('CallingClient Tests', function () {
|
|
|
1097
1297
|
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1098
1298
|
mobiusSocketMock.on.mockClear();
|
|
1099
1299
|
mobiusSocketMock.off.mockClear();
|
|
1100
|
-
|
|
1300
|
+
_context36.next = 1;
|
|
1101
1301
|
return (0, _CallingClient.createClient)(webex, {
|
|
1102
1302
|
logger: {
|
|
1103
1303
|
level: _types.LOGGER.INFO
|
|
1104
1304
|
}
|
|
1105
1305
|
});
|
|
1106
1306
|
case 1:
|
|
1107
|
-
callingClient =
|
|
1307
|
+
callingClient = _context36.sent;
|
|
1108
1308
|
asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1109
1309
|
return call[0] === 'event:async_event';
|
|
1110
1310
|
});
|
|
1111
1311
|
asyncEventCallback = asyncEventOnCall[1];
|
|
1112
1312
|
case 2:
|
|
1113
1313
|
case "end":
|
|
1114
|
-
return
|
|
1314
|
+
return _context36.stop();
|
|
1115
1315
|
}
|
|
1116
|
-
},
|
|
1316
|
+
}, _callee36);
|
|
1117
1317
|
})));
|
|
1118
1318
|
afterEach(function () {
|
|
1119
1319
|
callingClient.removeAllListeners();
|
|
@@ -1122,15 +1322,15 @@ describe('CallingClient Tests', function () {
|
|
|
1122
1322
|
value: false
|
|
1123
1323
|
});
|
|
1124
1324
|
});
|
|
1125
|
-
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1325
|
+
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1126
1326
|
var callEventSpy;
|
|
1127
|
-
return _regenerator.default.wrap(function (
|
|
1128
|
-
while (1) switch (
|
|
1327
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1328
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1129
1329
|
case 0:
|
|
1130
1330
|
callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
|
|
1131
1331
|
return undefined;
|
|
1132
1332
|
});
|
|
1133
|
-
|
|
1333
|
+
_context37.next = 1;
|
|
1134
1334
|
return asyncEventCallback({
|
|
1135
1335
|
type: 'async_event',
|
|
1136
1336
|
data: {
|
|
@@ -1150,9 +1350,9 @@ describe('CallingClient Tests', function () {
|
|
|
1150
1350
|
}));
|
|
1151
1351
|
case 2:
|
|
1152
1352
|
case "end":
|
|
1153
|
-
return
|
|
1353
|
+
return _context37.stop();
|
|
1154
1354
|
}
|
|
1155
|
-
},
|
|
1355
|
+
}, _callee37);
|
|
1156
1356
|
})));
|
|
1157
1357
|
});
|
|
1158
1358
|
describe('Mobius socket connection events', function () {
|
|
@@ -1164,9 +1364,9 @@ describe('CallingClient Tests', function () {
|
|
|
1164
1364
|
});
|
|
1165
1365
|
return onCall[1];
|
|
1166
1366
|
};
|
|
1167
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1168
|
-
return _regenerator.default.wrap(function (
|
|
1169
|
-
while (1) switch (
|
|
1367
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1368
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
1369
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1170
1370
|
case 0:
|
|
1171
1371
|
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1172
1372
|
value: true
|
|
@@ -1179,19 +1379,19 @@ describe('CallingClient Tests', function () {
|
|
|
1179
1379
|
mobiusSocketMock.on.mockClear();
|
|
1180
1380
|
mobiusSocketMock.off.mockClear();
|
|
1181
1381
|
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1182
|
-
|
|
1382
|
+
_context38.next = 1;
|
|
1183
1383
|
return (0, _CallingClient.createClient)(webex, {
|
|
1184
1384
|
logger: {
|
|
1185
1385
|
level: _types.LOGGER.INFO
|
|
1186
1386
|
}
|
|
1187
1387
|
});
|
|
1188
1388
|
case 1:
|
|
1189
|
-
callingClient =
|
|
1389
|
+
callingClient = _context38.sent;
|
|
1190
1390
|
case 2:
|
|
1191
1391
|
case "end":
|
|
1192
|
-
return
|
|
1392
|
+
return _context38.stop();
|
|
1193
1393
|
}
|
|
1194
|
-
},
|
|
1394
|
+
}, _callee38);
|
|
1195
1395
|
})));
|
|
1196
1396
|
afterEach(function () {
|
|
1197
1397
|
callingClient.removeAllListeners();
|
|
@@ -1224,34 +1424,34 @@ describe('CallingClient Tests', function () {
|
|
|
1224
1424
|
var callingClient;
|
|
1225
1425
|
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1226
1426
|
var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
|
|
1227
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1228
|
-
return _regenerator.default.wrap(function (
|
|
1229
|
-
while (1) switch (
|
|
1427
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1428
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
1429
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1230
1430
|
case 0:
|
|
1231
|
-
|
|
1431
|
+
_context39.next = 1;
|
|
1232
1432
|
return (0, _CallingClient.createClient)(webex, {
|
|
1233
1433
|
logger: {
|
|
1234
1434
|
level: _types.LOGGER.INFO
|
|
1235
1435
|
}
|
|
1236
1436
|
});
|
|
1237
1437
|
case 1:
|
|
1238
|
-
callingClient =
|
|
1438
|
+
callingClient = _context39.sent;
|
|
1239
1439
|
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1240
1440
|
callingClient.backupMobiusUris = [backupMobius];
|
|
1241
1441
|
webex.request.mockClear();
|
|
1242
1442
|
case 2:
|
|
1243
1443
|
case "end":
|
|
1244
|
-
return
|
|
1444
|
+
return _context39.stop();
|
|
1245
1445
|
}
|
|
1246
|
-
},
|
|
1446
|
+
}, _callee39);
|
|
1247
1447
|
})));
|
|
1248
1448
|
afterEach(function () {
|
|
1249
1449
|
callingClient.removeAllListeners();
|
|
1250
1450
|
});
|
|
1251
|
-
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1451
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
1252
1452
|
var devices, responsePayload, response;
|
|
1253
|
-
return _regenerator.default.wrap(function (
|
|
1254
|
-
while (1) switch (
|
|
1453
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
1454
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1255
1455
|
case 0:
|
|
1256
1456
|
devices = [{
|
|
1257
1457
|
deviceId: 'device-1',
|
|
@@ -1269,10 +1469,10 @@ describe('CallingClient Tests', function () {
|
|
|
1269
1469
|
}
|
|
1270
1470
|
};
|
|
1271
1471
|
webex.request.mockResolvedValue(responsePayload);
|
|
1272
|
-
|
|
1472
|
+
_context40.next = 1;
|
|
1273
1473
|
return callingClient.getDevices('user-123');
|
|
1274
1474
|
case 1:
|
|
1275
|
-
response =
|
|
1475
|
+
response = _context40.sent;
|
|
1276
1476
|
expect(webex.request).toHaveBeenCalledWith({
|
|
1277
1477
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1278
1478
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -1282,14 +1482,14 @@ describe('CallingClient Tests', function () {
|
|
|
1282
1482
|
expect(response).toEqual(devices);
|
|
1283
1483
|
case 2:
|
|
1284
1484
|
case "end":
|
|
1285
|
-
return
|
|
1485
|
+
return _context40.stop();
|
|
1286
1486
|
}
|
|
1287
|
-
},
|
|
1487
|
+
}, _callee40);
|
|
1288
1488
|
})));
|
|
1289
|
-
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1489
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
1290
1490
|
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1291
|
-
return _regenerator.default.wrap(function (
|
|
1292
|
-
while (1) switch (
|
|
1491
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
1492
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1293
1493
|
case 0:
|
|
1294
1494
|
devices = [{
|
|
1295
1495
|
deviceId: 'device-2',
|
|
@@ -1310,10 +1510,10 @@ describe('CallingClient Tests', function () {
|
|
|
1310
1510
|
}
|
|
1311
1511
|
};
|
|
1312
1512
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1313
|
-
|
|
1513
|
+
_context41.next = 1;
|
|
1314
1514
|
return callingClient.getDevices('user-123');
|
|
1315
1515
|
case 1:
|
|
1316
|
-
response =
|
|
1516
|
+
response = _context41.sent;
|
|
1317
1517
|
requestCalls = webex.request.mock.calls;
|
|
1318
1518
|
expect(requestCalls[0][0]).toEqual({
|
|
1319
1519
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
@@ -1330,9 +1530,9 @@ describe('CallingClient Tests', function () {
|
|
|
1330
1530
|
expect(response).toEqual(devices);
|
|
1331
1531
|
case 2:
|
|
1332
1532
|
case "end":
|
|
1333
|
-
return
|
|
1533
|
+
return _context41.stop();
|
|
1334
1534
|
}
|
|
1335
|
-
},
|
|
1535
|
+
}, _callee41);
|
|
1336
1536
|
})));
|
|
1337
1537
|
});
|
|
1338
1538
|
describe('windowsChromiumIceWarmup', function () {
|
|
@@ -1408,17 +1608,17 @@ describe('CallingClient Tests', function () {
|
|
|
1408
1608
|
afterAll(function () {
|
|
1409
1609
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1410
1610
|
});
|
|
1411
|
-
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1412
|
-
return _regenerator.default.wrap(function (
|
|
1413
|
-
while (1) switch (
|
|
1611
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
1612
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
1613
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1414
1614
|
case 0:
|
|
1415
|
-
|
|
1615
|
+
_context42.next = 1;
|
|
1416
1616
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1417
1617
|
case 1:
|
|
1418
1618
|
case "end":
|
|
1419
|
-
return
|
|
1619
|
+
return _context42.stop();
|
|
1420
1620
|
}
|
|
1421
|
-
},
|
|
1621
|
+
}, _callee42);
|
|
1422
1622
|
})));
|
|
1423
1623
|
});
|
|
1424
1624
|
});
|