@webex/calling 3.8.1-web-workers-keepalive.2 → 3.9.0
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/CallSettings/WxCallBackendConnector.js +2 -2
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +94 -27
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +56 -21
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +162 -98
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/constants.js +3 -4
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/registration/register.js +278 -198
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +168 -85
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/common/Utils.js +13 -7
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +265 -119
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/module/CallSettings/WxCallBackendConnector.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +23 -8
- package/dist/module/CallingClient/constants.js +1 -2
- package/dist/module/CallingClient/registration/register.js +39 -6
- package/dist/module/common/Utils.js +8 -1
- package/dist/types/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +1 -2
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +1 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/package.json +4 -5
|
@@ -117,6 +117,7 @@ describe('Registration Tests', function () {
|
|
|
117
117
|
var restartSpy;
|
|
118
118
|
var restoreSpy;
|
|
119
119
|
var postRegistrationSpy;
|
|
120
|
+
var deregisterSpy;
|
|
120
121
|
var failoverSpy;
|
|
121
122
|
var retry429Spy;
|
|
122
123
|
var metricSpy;
|
|
@@ -128,6 +129,7 @@ describe('Registration Tests', function () {
|
|
|
128
129
|
restartSpy = jest.spyOn(reg, 'restartRegistration');
|
|
129
130
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
130
131
|
postRegistrationSpy = jest.spyOn(reg, 'postRegistration');
|
|
132
|
+
deregisterSpy = jest.spyOn(reg, 'deregister');
|
|
131
133
|
failoverSpy = jest.spyOn(reg, 'startFailoverTimer');
|
|
132
134
|
retry429Spy = jest.spyOn(reg, 'handle429Retry');
|
|
133
135
|
metricSpy = jest.spyOn(reg.metricManager, 'submitRegistrationMetric');
|
|
@@ -467,7 +469,7 @@ describe('Registration Tests', function () {
|
|
|
467
469
|
_context7.next = 5;
|
|
468
470
|
return reg.triggerRegistration();
|
|
469
471
|
case 5:
|
|
470
|
-
jest.advanceTimersByTime(_constants.
|
|
472
|
+
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
471
473
|
_context7.next = 8;
|
|
472
474
|
return flushPromises();
|
|
473
475
|
case 8:
|
|
@@ -628,7 +630,7 @@ describe('Registration Tests', function () {
|
|
|
628
630
|
_context11.next = 6;
|
|
629
631
|
return reg.triggerRegistration();
|
|
630
632
|
case 6:
|
|
631
|
-
jest.advanceTimersByTime(_constants.
|
|
633
|
+
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
632
634
|
_context11.next = 9;
|
|
633
635
|
return flushPromises();
|
|
634
636
|
case 9:
|
|
@@ -697,20 +699,23 @@ describe('Registration Tests', function () {
|
|
|
697
699
|
})));
|
|
698
700
|
});
|
|
699
701
|
describe('Registration failback tests', function () {
|
|
702
|
+
var isPrimaryActiveSpy;
|
|
700
703
|
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
701
704
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
702
705
|
while (1) switch (_context13.prev = _context13.next) {
|
|
703
706
|
case 0:
|
|
707
|
+
isPrimaryActiveSpy = jest.spyOn(reg, 'isPrimaryActive');
|
|
708
|
+
isPrimaryActiveSpy.mockReturnValue(true);
|
|
704
709
|
/* keep keepalive as active so that it wont interfere with the failback tests */
|
|
705
710
|
jest.useFakeTimers();
|
|
706
711
|
postRegistrationSpy.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
707
|
-
_context13.next =
|
|
712
|
+
_context13.next = 6;
|
|
708
713
|
return reg.triggerRegistration();
|
|
709
|
-
case
|
|
714
|
+
case 6:
|
|
710
715
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
711
|
-
_context13.next =
|
|
716
|
+
_context13.next = 9;
|
|
712
717
|
return flushPromises();
|
|
713
|
-
case
|
|
718
|
+
case 9:
|
|
714
719
|
reg.rehomingIntervalMin = _constants.DEFAULT_REHOMING_INTERVAL_MIN;
|
|
715
720
|
reg.rehomingIntervalMax = _constants.DEFAULT_REHOMING_INTERVAL_MAX;
|
|
716
721
|
|
|
@@ -720,7 +725,7 @@ describe('Registration Tests', function () {
|
|
|
720
725
|
/* Active Url must match with the backup url as per the test */
|
|
721
726
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(mobiusUris.backup[0]);
|
|
722
727
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
723
|
-
case
|
|
728
|
+
case 14:
|
|
724
729
|
case "end":
|
|
725
730
|
return _context13.stop();
|
|
726
731
|
}
|
|
@@ -875,13 +880,14 @@ describe('Registration Tests', function () {
|
|
|
875
880
|
});
|
|
876
881
|
|
|
877
882
|
/* Active Url must now match with the primary url */
|
|
883
|
+
expect(deregisterSpy).toBeCalledOnceWith();
|
|
878
884
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(mobiusUris.primary[0]);
|
|
879
885
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
880
886
|
expect(reg.failbackTimer).toBe(undefined);
|
|
881
887
|
expect(restoreSpy).not.toBeCalled();
|
|
882
888
|
expect(reg.rehomingIntervalMin).toBe(_registerFixtures.mockPostResponse.rehomingIntervalMin);
|
|
883
889
|
expect(reg.rehomingIntervalMax).toBe(_registerFixtures.mockPostResponse.rehomingIntervalMax);
|
|
884
|
-
case
|
|
890
|
+
case 12:
|
|
885
891
|
case "end":
|
|
886
892
|
return _context18.stop();
|
|
887
893
|
}
|
|
@@ -901,7 +907,7 @@ describe('Registration Tests', function () {
|
|
|
901
907
|
_context19.next = 6;
|
|
902
908
|
return flushPromises();
|
|
903
909
|
case 6:
|
|
904
|
-
expect(infoSpy).toBeCalledWith("Active calls present, deferring failback to next cycle.", {
|
|
910
|
+
expect(infoSpy).toBeCalledWith("Active calls present or primary Mobius is down, deferring failback to next cycle.", {
|
|
905
911
|
method: 'executeFailback',
|
|
906
912
|
file: _constants.REGISTRATION_FILE
|
|
907
913
|
});
|
|
@@ -909,44 +915,71 @@ describe('Registration Tests', function () {
|
|
|
909
915
|
/* Active Url should still match backup url */
|
|
910
916
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(mobiusUris.backup[0]);
|
|
911
917
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
918
|
+
expect(deregisterSpy).not.toBeCalled();
|
|
912
919
|
expect(restoreSpy).not.toBeCalled();
|
|
913
920
|
expect(restartSpy).not.toBeCalled();
|
|
914
|
-
expect(infoSpy).toBeCalledWith('Active calls present, deferring failback to next cycle.', {
|
|
921
|
+
expect(infoSpy).toBeCalledWith('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
|
|
915
922
|
file: _constants.REGISTRATION_FILE,
|
|
916
923
|
method: _constants.FAILBACK_UTIL
|
|
917
924
|
});
|
|
918
925
|
expect(reg.rehomingIntervalMin).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MIN);
|
|
919
926
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
920
|
-
case
|
|
927
|
+
case 15:
|
|
921
928
|
case "end":
|
|
922
929
|
return _context19.stop();
|
|
923
930
|
}
|
|
924
931
|
}, _callee19);
|
|
925
932
|
})));
|
|
933
|
+
it('verify unsuccessful failback attempt due to primary server being down', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
934
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
935
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
936
|
+
case 0:
|
|
937
|
+
isPrimaryActiveSpy.mockReturnValue(false);
|
|
938
|
+
|
|
939
|
+
/* Wait for failback to be triggered. */
|
|
940
|
+
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
941
|
+
_context20.next = 4;
|
|
942
|
+
return flushPromises();
|
|
943
|
+
case 4:
|
|
944
|
+
expect(infoSpy).toBeCalledWith("Active calls present or primary Mobius is down, deferring failback to next cycle.", {
|
|
945
|
+
method: 'executeFailback',
|
|
946
|
+
file: _constants.REGISTRATION_FILE
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
/* Active Url should still match backup url */
|
|
950
|
+
expect(deregisterSpy).not.toBeCalled();
|
|
951
|
+
expect(reg.getActiveMobiusUrl()).toStrictEqual(mobiusUris.backup[0]);
|
|
952
|
+
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
953
|
+
case 8:
|
|
954
|
+
case "end":
|
|
955
|
+
return _context20.stop();
|
|
956
|
+
}
|
|
957
|
+
}, _callee20);
|
|
958
|
+
})));
|
|
926
959
|
});
|
|
927
960
|
|
|
928
961
|
// Keep-alive related test cases
|
|
929
962
|
describe('Keep-alive Tests', function () {
|
|
930
963
|
var beforeEachSetupForKeepalive = /*#__PURE__*/function () {
|
|
931
|
-
var
|
|
932
|
-
return _regenerator.default.wrap(function
|
|
933
|
-
while (1) switch (
|
|
964
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
965
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
966
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
934
967
|
case 0:
|
|
935
968
|
postRegistrationSpy.mockResolvedValueOnce(successPayload);
|
|
936
969
|
jest.useFakeTimers();
|
|
937
|
-
|
|
970
|
+
_context21.next = 4;
|
|
938
971
|
return reg.triggerRegistration();
|
|
939
972
|
case 4:
|
|
940
973
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
941
974
|
expect(reg.webWorker).toBeDefined();
|
|
942
975
|
case 6:
|
|
943
976
|
case "end":
|
|
944
|
-
return
|
|
977
|
+
return _context21.stop();
|
|
945
978
|
}
|
|
946
|
-
},
|
|
979
|
+
}, _callee21);
|
|
947
980
|
}));
|
|
948
981
|
return function beforeEachSetupForKeepalive() {
|
|
949
|
-
return
|
|
982
|
+
return _ref21.apply(this, arguments);
|
|
950
983
|
};
|
|
951
984
|
}();
|
|
952
985
|
afterEach(function () {
|
|
@@ -959,13 +992,13 @@ describe('Registration Tests', function () {
|
|
|
959
992
|
call.end();
|
|
960
993
|
});
|
|
961
994
|
});
|
|
962
|
-
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
995
|
+
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
963
996
|
var postMessageSpy;
|
|
964
|
-
return _regenerator.default.wrap(function
|
|
965
|
-
while (1) switch (
|
|
997
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
998
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
966
999
|
case 0:
|
|
967
1000
|
postMessageSpy = jest.spyOn(Worker.prototype, 'postMessage');
|
|
968
|
-
|
|
1001
|
+
_context22.next = 3;
|
|
969
1002
|
return beforeEachSetupForKeepalive();
|
|
970
1003
|
case 3:
|
|
971
1004
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -986,16 +1019,16 @@ describe('Registration Tests', function () {
|
|
|
986
1019
|
expect(lineEmitter).toBeCalledWith(_types4.LINE_EVENTS.RECONNECTED);
|
|
987
1020
|
case 7:
|
|
988
1021
|
case "end":
|
|
989
|
-
return
|
|
1022
|
+
return _context22.stop();
|
|
990
1023
|
}
|
|
991
|
-
},
|
|
1024
|
+
}, _callee22);
|
|
992
1025
|
})));
|
|
993
|
-
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1026
|
+
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
994
1027
|
var worker;
|
|
995
|
-
return _regenerator.default.wrap(function
|
|
996
|
-
while (1) switch (
|
|
1028
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
1029
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
997
1030
|
case 0:
|
|
998
|
-
|
|
1031
|
+
_context23.next = 2;
|
|
999
1032
|
return beforeEachSetupForKeepalive();
|
|
1000
1033
|
case 2:
|
|
1001
1034
|
worker = reg.webWorker;
|
|
@@ -1018,16 +1051,16 @@ describe('Registration Tests', function () {
|
|
|
1018
1051
|
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.RECONNECTED);
|
|
1019
1052
|
case 7:
|
|
1020
1053
|
case "end":
|
|
1021
|
-
return
|
|
1054
|
+
return _context23.stop();
|
|
1022
1055
|
}
|
|
1023
|
-
},
|
|
1056
|
+
}, _callee23);
|
|
1024
1057
|
})));
|
|
1025
|
-
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1058
|
+
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1026
1059
|
var reconnectSpy, restoreSpy, restartRegSpy, RETRY_COUNT_THRESHOLD, failureEvent;
|
|
1027
|
-
return _regenerator.default.wrap(function
|
|
1028
|
-
while (1) switch (
|
|
1060
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
1061
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1029
1062
|
case 0:
|
|
1030
|
-
|
|
1063
|
+
_context24.next = 2;
|
|
1031
1064
|
return beforeEachSetupForKeepalive();
|
|
1032
1065
|
case 2:
|
|
1033
1066
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -1054,7 +1087,7 @@ describe('Registration Tests', function () {
|
|
|
1054
1087
|
}
|
|
1055
1088
|
};
|
|
1056
1089
|
reg.webWorker.onmessage(failureEvent);
|
|
1057
|
-
|
|
1090
|
+
_context24.next = 14;
|
|
1058
1091
|
return flushPromises();
|
|
1059
1092
|
case 14:
|
|
1060
1093
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
@@ -1069,16 +1102,16 @@ describe('Registration Tests', function () {
|
|
|
1069
1102
|
}));
|
|
1070
1103
|
case 21:
|
|
1071
1104
|
case "end":
|
|
1072
|
-
return
|
|
1105
|
+
return _context24.stop();
|
|
1073
1106
|
}
|
|
1074
|
-
},
|
|
1107
|
+
}, _callee24);
|
|
1075
1108
|
})));
|
|
1076
|
-
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1109
|
+
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1077
1110
|
var reconnectSpy, url;
|
|
1078
|
-
return _regenerator.default.wrap(function
|
|
1079
|
-
while (1) switch (
|
|
1111
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
1112
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1080
1113
|
case 0:
|
|
1081
|
-
|
|
1114
|
+
_context25.next = 2;
|
|
1082
1115
|
return beforeEachSetupForKeepalive();
|
|
1083
1116
|
case 2:
|
|
1084
1117
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1094,16 +1127,16 @@ describe('Registration Tests', function () {
|
|
|
1094
1127
|
}
|
|
1095
1128
|
});
|
|
1096
1129
|
jest.advanceTimersByTime(1000);
|
|
1097
|
-
|
|
1130
|
+
_context25.next = 9;
|
|
1098
1131
|
return flushPromises();
|
|
1099
1132
|
case 9:
|
|
1100
1133
|
expect(reg.webWorker).toBeUndefined();
|
|
1101
1134
|
expect(reconnectSpy).toBeCalledOnceWith(reg.startKeepaliveTimer.name);
|
|
1102
1135
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1103
|
-
|
|
1136
|
+
_context25.next = 14;
|
|
1104
1137
|
return reg.triggerRegistration();
|
|
1105
1138
|
case 14:
|
|
1106
|
-
|
|
1139
|
+
_context25.next = 16;
|
|
1107
1140
|
return flushPromises();
|
|
1108
1141
|
case 16:
|
|
1109
1142
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1116,7 +1149,7 @@ describe('Registration Tests', function () {
|
|
|
1116
1149
|
|
|
1117
1150
|
// Advance timers and flush any remaining promises.
|
|
1118
1151
|
jest.advanceTimersByTime(1000);
|
|
1119
|
-
|
|
1152
|
+
_context25.next = 21;
|
|
1120
1153
|
return flushPromises();
|
|
1121
1154
|
case 21:
|
|
1122
1155
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1128,15 +1161,15 @@ describe('Registration Tests', function () {
|
|
|
1128
1161
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(url);
|
|
1129
1162
|
case 26:
|
|
1130
1163
|
case "end":
|
|
1131
|
-
return
|
|
1164
|
+
return _context25.stop();
|
|
1132
1165
|
}
|
|
1133
|
-
},
|
|
1166
|
+
}, _callee25);
|
|
1134
1167
|
})));
|
|
1135
|
-
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1136
|
-
return _regenerator.default.wrap(function
|
|
1137
|
-
while (1) switch (
|
|
1168
|
+
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1169
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
1170
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1138
1171
|
case 0:
|
|
1139
|
-
|
|
1172
|
+
_context26.next = 2;
|
|
1140
1173
|
return beforeEachSetupForKeepalive();
|
|
1141
1174
|
case 2:
|
|
1142
1175
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1149,15 +1182,15 @@ describe('Registration Tests', function () {
|
|
|
1149
1182
|
keepAliveRetryCount: reg.isCCFlow ? 4 : 5
|
|
1150
1183
|
}
|
|
1151
1184
|
});
|
|
1152
|
-
|
|
1185
|
+
_context26.next = 8;
|
|
1153
1186
|
return flushPromises();
|
|
1154
1187
|
case 8:
|
|
1155
1188
|
expect(reg.webWorker).toBeUndefined();
|
|
1156
1189
|
expect(handleErrorSpy).toBeCalledTimes(3);
|
|
1157
|
-
|
|
1190
|
+
_context26.next = 12;
|
|
1158
1191
|
return reg.triggerRegistration();
|
|
1159
1192
|
case 12:
|
|
1160
|
-
|
|
1193
|
+
_context26.next = 14;
|
|
1161
1194
|
return flushPromises();
|
|
1162
1195
|
case 14:
|
|
1163
1196
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1167,7 +1200,7 @@ describe('Registration Tests', function () {
|
|
|
1167
1200
|
statusCode: 200
|
|
1168
1201
|
}
|
|
1169
1202
|
});
|
|
1170
|
-
|
|
1203
|
+
_context26.next = 18;
|
|
1171
1204
|
return flushPromises();
|
|
1172
1205
|
case 18:
|
|
1173
1206
|
// In a complete failure‐then-recovery scenario, we expect another failure event to have been handled.
|
|
@@ -1179,16 +1212,16 @@ describe('Registration Tests', function () {
|
|
|
1179
1212
|
keepAliveRetryCount: reg.isCCFlow ? 4 : 5
|
|
1180
1213
|
}
|
|
1181
1214
|
});
|
|
1182
|
-
|
|
1215
|
+
_context26.next = 21;
|
|
1183
1216
|
return flushPromises();
|
|
1184
1217
|
case 21:
|
|
1185
1218
|
expect(handleErrorSpy).toBeCalledTimes(4);
|
|
1186
1219
|
|
|
1187
1220
|
// And then re-register successfully:
|
|
1188
|
-
|
|
1221
|
+
_context26.next = 24;
|
|
1189
1222
|
return reg.triggerRegistration();
|
|
1190
1223
|
case 24:
|
|
1191
|
-
|
|
1224
|
+
_context26.next = 26;
|
|
1192
1225
|
return flushPromises();
|
|
1193
1226
|
case 26:
|
|
1194
1227
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1198,31 +1231,31 @@ describe('Registration Tests', function () {
|
|
|
1198
1231
|
statusCode: 200
|
|
1199
1232
|
}
|
|
1200
1233
|
});
|
|
1201
|
-
|
|
1234
|
+
_context26.next = 30;
|
|
1202
1235
|
return flushPromises();
|
|
1203
1236
|
case 30:
|
|
1204
1237
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
1205
1238
|
expect(reg.webWorker).toBeDefined();
|
|
1206
1239
|
case 32:
|
|
1207
1240
|
case "end":
|
|
1208
|
-
return
|
|
1241
|
+
return _context26.stop();
|
|
1209
1242
|
}
|
|
1210
|
-
},
|
|
1243
|
+
}, _callee26);
|
|
1211
1244
|
})));
|
|
1212
|
-
it('cc: verify failover to backup server after 4 keep alive failure with primary server', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1245
|
+
it('cc: verify failover to backup server after 4 keep alive failure with primary server', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1213
1246
|
var clearKeepaliveSpy, reconnectSpy;
|
|
1214
|
-
return _regenerator.default.wrap(function
|
|
1215
|
-
while (1) switch (
|
|
1247
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
1248
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1216
1249
|
case 0:
|
|
1217
1250
|
// Register with contact center service
|
|
1218
1251
|
setupRegistration(_objectSpread(_objectSpread({}, MockServiceData), {}, {
|
|
1219
1252
|
indicator: _types.ServiceIndicator.CONTACT_CENTER
|
|
1220
1253
|
}));
|
|
1221
|
-
|
|
1254
|
+
_context27.next = 3;
|
|
1222
1255
|
return beforeEachSetupForKeepalive();
|
|
1223
1256
|
case 3:
|
|
1224
1257
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1225
|
-
|
|
1258
|
+
_context27.next = 6;
|
|
1226
1259
|
return reg.triggerRegistration();
|
|
1227
1260
|
case 6:
|
|
1228
1261
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1242,7 +1275,7 @@ describe('Registration Tests', function () {
|
|
|
1242
1275
|
});
|
|
1243
1276
|
|
|
1244
1277
|
// Wait for any asynchronous actions to complete
|
|
1245
|
-
|
|
1278
|
+
_context27.next = 13;
|
|
1246
1279
|
return flushPromises();
|
|
1247
1280
|
case 13:
|
|
1248
1281
|
// Verify that the keepalive timer was cleared and reconnectOnFailure was triggered
|
|
@@ -1254,16 +1287,16 @@ describe('Registration Tests', function () {
|
|
|
1254
1287
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
1255
1288
|
case 17:
|
|
1256
1289
|
case "end":
|
|
1257
|
-
return
|
|
1290
|
+
return _context27.stop();
|
|
1258
1291
|
}
|
|
1259
|
-
},
|
|
1292
|
+
}, _callee27);
|
|
1260
1293
|
})));
|
|
1261
|
-
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1294
|
+
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1262
1295
|
var reconnectSpy, restoreSpy, restartRegSpy, clearTimerSpy, threshold, failureEvent;
|
|
1263
|
-
return _regenerator.default.wrap(function
|
|
1264
|
-
while (1) switch (
|
|
1296
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
1297
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1265
1298
|
case 0:
|
|
1266
|
-
|
|
1299
|
+
_context28.next = 2;
|
|
1267
1300
|
return beforeEachSetupForKeepalive();
|
|
1268
1301
|
case 2:
|
|
1269
1302
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -1283,7 +1316,7 @@ describe('Registration Tests', function () {
|
|
|
1283
1316
|
}
|
|
1284
1317
|
};
|
|
1285
1318
|
reg.webWorker.onmessage(failureEvent);
|
|
1286
|
-
|
|
1319
|
+
_context28.next = 13;
|
|
1287
1320
|
return flushPromises();
|
|
1288
1321
|
case 13:
|
|
1289
1322
|
// At this point, clearKeepaliveTimer was called so the worker is terminated.
|
|
@@ -1308,10 +1341,10 @@ describe('Registration Tests', function () {
|
|
|
1308
1341
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1309
1342
|
|
|
1310
1343
|
// Call reconnectOnFailure manually. With no active calls, this should trigger re-registration.
|
|
1311
|
-
|
|
1344
|
+
_context28.next = 29;
|
|
1312
1345
|
return reg.reconnectOnFailure(_constants.CALLS_CLEARED_HANDLER_UTIL);
|
|
1313
1346
|
case 29:
|
|
1314
|
-
|
|
1347
|
+
_context28.next = 31;
|
|
1315
1348
|
return flushPromises();
|
|
1316
1349
|
case 31:
|
|
1317
1350
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
@@ -1324,16 +1357,16 @@ describe('Registration Tests', function () {
|
|
|
1324
1357
|
expect(reg.reconnectPending).toStrictEqual(false);
|
|
1325
1358
|
case 38:
|
|
1326
1359
|
case "end":
|
|
1327
|
-
return
|
|
1360
|
+
return _context28.stop();
|
|
1328
1361
|
}
|
|
1329
|
-
},
|
|
1362
|
+
}, _callee28);
|
|
1330
1363
|
})));
|
|
1331
|
-
it('checks for keep-alive failure with final error: 404', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1364
|
+
it('checks for keep-alive failure with final error: 404', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1332
1365
|
var reconnectSpy, restoreSpy, restartRegSpy, clearTimerSpy;
|
|
1333
|
-
return _regenerator.default.wrap(function
|
|
1334
|
-
while (1) switch (
|
|
1366
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
1367
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1335
1368
|
case 0:
|
|
1336
|
-
|
|
1369
|
+
_context29.next = 2;
|
|
1337
1370
|
return beforeEachSetupForKeepalive();
|
|
1338
1371
|
case 2:
|
|
1339
1372
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -1350,7 +1383,7 @@ describe('Registration Tests', function () {
|
|
|
1350
1383
|
keepAliveRetryCount: 1
|
|
1351
1384
|
}
|
|
1352
1385
|
});
|
|
1353
|
-
|
|
1386
|
+
_context29.next = 10;
|
|
1354
1387
|
return flushPromises();
|
|
1355
1388
|
case 10:
|
|
1356
1389
|
expect(warnSpy).toBeCalledWith('Keep-alive missed 1 times. Status -> 404 ', expect.objectContaining({
|
|
@@ -1374,9 +1407,59 @@ describe('Registration Tests', function () {
|
|
|
1374
1407
|
expect(reg.webWorker).toBeUndefined();
|
|
1375
1408
|
case 21:
|
|
1376
1409
|
case "end":
|
|
1377
|
-
return
|
|
1410
|
+
return _context29.stop();
|
|
1378
1411
|
}
|
|
1379
|
-
},
|
|
1412
|
+
}, _callee29);
|
|
1413
|
+
})));
|
|
1414
|
+
});
|
|
1415
|
+
describe('Primary server status checks', function () {
|
|
1416
|
+
it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1417
|
+
var pingSuccessPayload, status;
|
|
1418
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1419
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1420
|
+
case 0:
|
|
1421
|
+
pingSuccessPayload = {
|
|
1422
|
+
statusCode: 200
|
|
1423
|
+
};
|
|
1424
|
+
webex.request.mockResolvedValue(pingSuccessPayload);
|
|
1425
|
+
_context30.next = 4;
|
|
1426
|
+
return reg.isPrimaryActive();
|
|
1427
|
+
case 4:
|
|
1428
|
+
status = _context30.sent;
|
|
1429
|
+
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1430
|
+
method: 'GET',
|
|
1431
|
+
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
1432
|
+
}, (0, _testUtil.getMockRequestTemplate)()));
|
|
1433
|
+
expect(status).toEqual(true);
|
|
1434
|
+
case 7:
|
|
1435
|
+
case "end":
|
|
1436
|
+
return _context30.stop();
|
|
1437
|
+
}
|
|
1438
|
+
}, _callee30);
|
|
1439
|
+
})));
|
|
1440
|
+
it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1441
|
+
var pingFailurePayload, status;
|
|
1442
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
1443
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1444
|
+
case 0:
|
|
1445
|
+
pingFailurePayload = {
|
|
1446
|
+
statusCode: 500
|
|
1447
|
+
};
|
|
1448
|
+
webex.request.mockResolvedValue(pingFailurePayload);
|
|
1449
|
+
_context31.next = 4;
|
|
1450
|
+
return reg.isPrimaryActive();
|
|
1451
|
+
case 4:
|
|
1452
|
+
status = _context31.sent;
|
|
1453
|
+
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1454
|
+
method: 'GET',
|
|
1455
|
+
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
1456
|
+
}, (0, _testUtil.getMockRequestTemplate)()));
|
|
1457
|
+
expect(status).toEqual(false);
|
|
1458
|
+
case 7:
|
|
1459
|
+
case "end":
|
|
1460
|
+
return _context31.stop();
|
|
1461
|
+
}
|
|
1462
|
+
}, _callee31);
|
|
1380
1463
|
})));
|
|
1381
1464
|
});
|
|
1382
1465
|
});
|