@webex/calling 3.11.0 → 3.12.0-mobius-socket.1
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/CallHistory/CallHistory.js +596 -0
- package/dist/CallHistory/CallHistory.js.map +1 -0
- package/dist/CallHistory/CallHistory.test.js +916 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -0
- package/dist/CallHistory/callHistoryFixtures.js +650 -0
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -0
- package/dist/CallHistory/constants.js +38 -0
- package/dist/CallHistory/constants.js.map +1 -0
- package/dist/CallHistory/types.js +7 -0
- package/dist/CallHistory/types.js.map +1 -0
- package/dist/CallSettings/CallSettings.js +311 -0
- package/dist/CallSettings/CallSettings.js.map +1 -0
- package/dist/CallSettings/CallSettings.test.js +122 -0
- package/dist/CallSettings/CallSettings.test.js.map +1 -0
- package/dist/CallSettings/UcmBackendConnector.js +308 -0
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -0
- package/dist/CallSettings/UcmBackendConnector.test.js +411 -0
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.js +597 -0
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js +904 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/constants.js +31 -0
- package/dist/CallSettings/constants.js.map +1 -0
- package/dist/CallSettings/testFixtures.js +68 -0
- package/dist/CallSettings/testFixtures.js.map +1 -0
- package/dist/CallSettings/types.js +7 -0
- package/dist/CallSettings/types.js.map +1 -0
- package/dist/CallingClient/CallingClient.js +1346 -0
- package/dist/CallingClient/CallingClient.js.map +1 -0
- package/dist/CallingClient/CallingClient.test.js +1352 -0
- package/dist/CallingClient/CallingClient.test.js.map +1 -0
- package/dist/CallingClient/callRecordFixtures.js +101 -0
- package/dist/CallingClient/callRecordFixtures.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/index.js +275 -0
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/index.test.js +275 -0
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/types.js +7 -0
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -0
- package/dist/CallingClient/calling/call.js +3489 -0
- package/dist/CallingClient/calling/call.js.map +1 -0
- package/dist/CallingClient/calling/call.test.js +3653 -0
- package/dist/CallingClient/calling/call.test.js.map +1 -0
- package/dist/CallingClient/calling/callManager.js +481 -0
- package/dist/CallingClient/calling/callManager.js.map +1 -0
- package/dist/CallingClient/calling/callManager.test.js +776 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -0
- package/dist/CallingClient/calling/index.js +30 -0
- package/dist/CallingClient/calling/index.js.map +1 -0
- package/dist/CallingClient/calling/types.js +76 -0
- package/dist/CallingClient/calling/types.js.map +1 -0
- package/dist/CallingClient/callingClientFixtures.js +143 -0
- package/dist/CallingClient/callingClientFixtures.js.map +1 -0
- package/dist/CallingClient/constants.js +249 -0
- package/dist/CallingClient/constants.js.map +1 -0
- package/dist/CallingClient/line/index.js +332 -0
- package/dist/CallingClient/line/index.js.map +1 -0
- package/dist/CallingClient/line/line.test.js +342 -0
- package/dist/CallingClient/line/line.test.js.map +1 -0
- package/dist/CallingClient/line/types.js +21 -0
- package/dist/CallingClient/line/types.js.map +1 -0
- package/dist/CallingClient/registration/index.js +19 -0
- package/dist/CallingClient/registration/index.js.map +1 -0
- package/dist/CallingClient/registration/register.js +1713 -0
- package/dist/CallingClient/registration/register.js.map +1 -0
- package/dist/CallingClient/registration/register.test.js +1894 -0
- package/dist/CallingClient/registration/register.test.js.map +1 -0
- package/dist/CallingClient/registration/registerFixtures.js +36 -0
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -0
- package/dist/CallingClient/registration/types.js +7 -0
- package/dist/CallingClient/registration/types.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.js +132 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +303 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- package/dist/CallingClient/types.js +7 -0
- package/dist/CallingClient/types.js.map +1 -0
- package/dist/CallingClient/utils/constants.js +46 -0
- package/dist/CallingClient/utils/constants.js.map +1 -0
- package/dist/CallingClient/utils/index.js +63 -0
- package/dist/CallingClient/utils/index.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js +106 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
- package/dist/CallingClient/utils/request.js +267 -0
- package/dist/CallingClient/utils/request.js.map +1 -0
- package/dist/CallingClient/utils/types.js +7 -0
- package/dist/CallingClient/utils/types.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js +20 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +1206 -0
- package/dist/Contacts/ContactsClient.js.map +1 -0
- package/dist/Contacts/ContactsClient.test.js +1004 -0
- package/dist/Contacts/ContactsClient.test.js.map +1 -0
- package/dist/Contacts/constants.js +40 -0
- package/dist/Contacts/constants.js.map +1 -0
- package/dist/Contacts/contactFixtures.js +430 -0
- package/dist/Contacts/contactFixtures.js.map +1 -0
- package/dist/Contacts/types.js +43 -0
- package/dist/Contacts/types.js.map +1 -0
- package/dist/Errors/catalog/CallError.js +89 -0
- package/dist/Errors/catalog/CallError.js.map +1 -0
- package/dist/Errors/catalog/CallingDeviceError.js +83 -0
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -0
- package/dist/Errors/catalog/ExtendedError.js +42 -0
- package/dist/Errors/catalog/ExtendedError.js.map +1 -0
- package/dist/Errors/catalog/LineError.js +85 -0
- package/dist/Errors/catalog/LineError.js.map +1 -0
- package/dist/Errors/index.js +28 -0
- package/dist/Errors/index.js.map +1 -0
- package/dist/Errors/types.js +59 -0
- package/dist/Errors/types.js.map +1 -0
- package/dist/Events/impl/index.js +79 -0
- package/dist/Events/impl/index.js.map +1 -0
- package/dist/Events/types.js +97 -0
- package/dist/Events/types.js.map +1 -0
- package/dist/Logger/index.js +228 -0
- package/dist/Logger/index.js.map +1 -0
- package/dist/Logger/index.test.js +87 -0
- package/dist/Logger/index.test.js.map +1 -0
- package/dist/Logger/types.js +34 -0
- package/dist/Logger/types.js.map +1 -0
- package/dist/Metrics/index.js +534 -0
- package/dist/Metrics/index.js.map +1 -0
- package/dist/Metrics/index.test.js +463 -0
- package/dist/Metrics/index.test.js.map +1 -0
- package/dist/Metrics/types.js +64 -0
- package/dist/Metrics/types.js.map +1 -0
- package/dist/SDKConnector/index.js +134 -0
- package/dist/SDKConnector/index.js.map +1 -0
- package/dist/SDKConnector/index.test.js +9 -0
- package/dist/SDKConnector/index.test.js.map +1 -0
- package/dist/SDKConnector/types.js +7 -0
- package/dist/SDKConnector/types.js.map +1 -0
- package/dist/SDKConnector/utils.js +39 -0
- package/dist/SDKConnector/utils.js.map +1 -0
- package/dist/SDKConnector/utils.test.js +9 -0
- package/dist/SDKConnector/utils.test.js.map +1 -0
- package/dist/Voicemail/BroadworksBackendConnector.js +699 -0
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js +820 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.js +628 -0
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.test.js +738 -0
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/Voicemail.js +472 -0
- package/dist/Voicemail/Voicemail.js.map +1 -0
- package/dist/Voicemail/Voicemail.test.js +391 -0
- package/dist/Voicemail/Voicemail.test.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.js +657 -0
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js +1225 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/constants.js +61 -0
- package/dist/Voicemail/constants.js.map +1 -0
- package/dist/Voicemail/types.js +7 -0
- package/dist/Voicemail/types.js.map +1 -0
- package/dist/Voicemail/voicemailFixture.js +524 -0
- package/dist/Voicemail/voicemailFixture.js.map +1 -0
- package/dist/api.js +157 -0
- package/dist/api.js.map +1 -0
- package/dist/common/Utils.js +1542 -0
- package/dist/common/Utils.js.map +1 -0
- package/dist/common/Utils.test.js +1989 -0
- package/dist/common/Utils.test.js.map +1 -0
- package/dist/common/constants.js +62 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/testUtil.js +988 -0
- package/dist/common/testUtil.js.map +1 -0
- package/dist/common/types.js +75 -0
- package/dist/common/types.js.map +1 -0
- package/dist/index.js +321 -0
- package/dist/index.js.map +1 -0
- package/dist/module/CallHistory/CallHistory.js +28 -17
- package/dist/module/CallingClient/CallingClient.js +157 -4
- package/dist/module/CallingClient/calling/call.js +12 -8
- package/dist/module/CallingClient/calling/callManager.js +29 -10
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +8 -0
- package/dist/module/CallingClient/registration/register.js +46 -16
- package/dist/module/CallingClient/utils/constants.js +30 -0
- package/dist/module/CallingClient/utils/index.js +5 -0
- package/dist/module/CallingClient/utils/mobiusSocketMapper.js +56 -0
- package/dist/module/CallingClient/utils/request.js +112 -0
- package/dist/module/CallingClient/utils/types.js +1 -0
- package/dist/module/CallingClient/utils/wsFeatureFlag.js +5 -0
- package/dist/module/Events/types.js +0 -10
- package/dist/module/SDKConnector/index.js +17 -0
- package/dist/module/common/Utils.js +35 -4
- package/dist/module/common/testUtil.js +3 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +10 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +1 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +5 -4
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +21 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +8 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +2 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +3 -1
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/constants.d.ts +30 -0
- package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/index.d.ts +6 -0
- package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +4 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/request.d.ts +20 -0
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/types.d.ts +23 -0
- package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
- package/dist/types/Events/types.d.ts +0 -10
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/index.d.ts +2 -0
- package/dist/types/SDKConnector/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +11 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +4 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +3 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +5 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,738 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
7
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
8
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
9
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
10
|
+
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
11
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
|
+
var _types = require("../Logger/types");
|
|
16
|
+
var _testUtil = require("../common/testUtil");
|
|
17
|
+
var _types2 = require("../common/types");
|
|
18
|
+
var _voicemailFixture = require("./voicemailFixture");
|
|
19
|
+
var _UcmBackendConnector = require("./UcmBackendConnector");
|
|
20
|
+
var utils = _interopRequireWildcard(require("../common/Utils"));
|
|
21
|
+
var _constants = require("../common/constants");
|
|
22
|
+
var _Logger = _interopRequireDefault(require("../Logger"));
|
|
23
|
+
var _constants2 = require("./constants");
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable dot-notation */
|
|
27
|
+
var ucmBackendConnector;
|
|
28
|
+
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
29
|
+
var voicemailPayload;
|
|
30
|
+
var serviceErrorCodeHandlerSpy;
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
+
var sdkConnector;
|
|
33
|
+
var messageId = _voicemailFixture.mockUCMVoicemailBody.body.items['messageId'];
|
|
34
|
+
var logSpy;
|
|
35
|
+
var infoSpy;
|
|
36
|
+
var warnSpy;
|
|
37
|
+
var errorSpy;
|
|
38
|
+
jest.spyOn(utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
39
|
+
describe('Voicemail UCM Backend Connector Test case', function () {
|
|
40
|
+
var responseDetails = {
|
|
41
|
+
statusCode: 200,
|
|
42
|
+
message: _constants.SUCCESS_MESSAGE,
|
|
43
|
+
data: {}
|
|
44
|
+
};
|
|
45
|
+
var voicemailResponseInfo = _voicemailFixture.getDescVoiceMailListJsonUCM.body.Message;
|
|
46
|
+
var listResponseDetails = {
|
|
47
|
+
statusCode: 200,
|
|
48
|
+
data: voicemailResponseInfo,
|
|
49
|
+
message: _constants.SUCCESS_MESSAGE
|
|
50
|
+
};
|
|
51
|
+
beforeAll(function () {
|
|
52
|
+
webex.version = '2.31.1';
|
|
53
|
+
webex.internal.device.version = '2.31.1';
|
|
54
|
+
webex.internal.device.features.entitlement.models = [{
|
|
55
|
+
_values: {
|
|
56
|
+
key: 'ucm-calling'
|
|
57
|
+
}
|
|
58
|
+
}];
|
|
59
|
+
webex.internal.device.callingBehavior = 'NATIVE_SIP_CALL_TO_UCM';
|
|
60
|
+
ucmBackendConnector = new _UcmBackendConnector.UcmBackendConnector(webex, {
|
|
61
|
+
level: _types.LOGGER.INFO
|
|
62
|
+
});
|
|
63
|
+
ucmBackendConnector.init();
|
|
64
|
+
sdkConnector = ucmBackendConnector.getSDKConnector();
|
|
65
|
+
voicemailPayload = _voicemailFixture.getVoiceMailListJsonUCM;
|
|
66
|
+
});
|
|
67
|
+
beforeEach(function () {
|
|
68
|
+
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
69
|
+
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
70
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
71
|
+
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
72
|
+
});
|
|
73
|
+
afterEach(function () {
|
|
74
|
+
jest.clearAllMocks();
|
|
75
|
+
});
|
|
76
|
+
it('verify UCM Backend Connector object', function () {
|
|
77
|
+
expect(ucmBackendConnector.getSDKConnector().getWebex()).toBeTruthy();
|
|
78
|
+
expect(ucmBackendConnector.getSDKConnector().getWebex().internal.device.userId).toBe('8a67806f-fc4d-446b-a131-31e71ea5b0e9');
|
|
79
|
+
});
|
|
80
|
+
it('verify fetching transcript returned null', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
81
|
+
var response;
|
|
82
|
+
return _regenerator.default.wrap(function (_context) {
|
|
83
|
+
while (1) switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
_context.next = 1;
|
|
86
|
+
return ucmBackendConnector.getVMTranscript('98099432-9d81-4224-bd04-00def73cd262');
|
|
87
|
+
case 1:
|
|
88
|
+
response = _context.sent;
|
|
89
|
+
expect(response).toBeNull();
|
|
90
|
+
expect(infoSpy).toHaveBeenCalledWith('Message Id: 98099432-9d81-4224-bd04-00def73cd262', {});
|
|
91
|
+
case 2:
|
|
92
|
+
case "end":
|
|
93
|
+
return _context.stop();
|
|
94
|
+
}
|
|
95
|
+
}, _callee);
|
|
96
|
+
})));
|
|
97
|
+
it('verify successful voicemail list', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
98
|
+
var response;
|
|
99
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
100
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
webex.request.mockResolvedValueOnce(voicemailPayload);
|
|
103
|
+
_context2.next = 1;
|
|
104
|
+
return ucmBackendConnector.getVoicemailList(0, 20, _types2.SORT.DESC);
|
|
105
|
+
case 1:
|
|
106
|
+
response = _context2.sent;
|
|
107
|
+
expect(response).toStrictEqual(listResponseDetails);
|
|
108
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
109
|
+
headers: {
|
|
110
|
+
orgId: _voicemailFixture.orgId
|
|
111
|
+
},
|
|
112
|
+
method: _types2.HTTP_METHODS.GET,
|
|
113
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl + _voicemailFixture.voicemailContent)
|
|
114
|
+
});
|
|
115
|
+
expect(infoSpy).toHaveBeenCalledWith('invoking with Offset: 0 Offset limit: 20 Sort type:DESC', {
|
|
116
|
+
file: 'UcmBackendConnector',
|
|
117
|
+
method: _constants2.METHODS.GET_VOICEMAIL_LIST
|
|
118
|
+
});
|
|
119
|
+
expect(logSpy).toHaveBeenCalledWith('Successfully retrieved voicemail list', {
|
|
120
|
+
file: 'UcmBackendConnector',
|
|
121
|
+
method: 'getVoicemailList'
|
|
122
|
+
});
|
|
123
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
|
124
|
+
expect(errorSpy).not.toHaveBeenCalled();
|
|
125
|
+
case 2:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context2.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee2);
|
|
130
|
+
})));
|
|
131
|
+
it('verify successful voicemailContent', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
132
|
+
var voiceMailPayload, response, voicemailContentResponse, vmResponseDetails;
|
|
133
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
134
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
voiceMailPayload = _voicemailFixture.mockVoicemailContentResponse;
|
|
137
|
+
webex.request.mockResolvedValueOnce(voiceMailPayload);
|
|
138
|
+
_context3.next = 1;
|
|
139
|
+
return ucmBackendConnector.getVoicemailContent(messageId);
|
|
140
|
+
case 1:
|
|
141
|
+
response = _context3.sent.data;
|
|
142
|
+
voicemailContentResponse = _voicemailFixture.voicemailContent;
|
|
143
|
+
vmResponseDetails = {
|
|
144
|
+
voicemailContent: {
|
|
145
|
+
type: 'audio/wav',
|
|
146
|
+
content: voicemailContentResponse
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
expect(response).toStrictEqual(vmResponseDetails);
|
|
150
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
151
|
+
headers: {
|
|
152
|
+
orgId: _voicemailFixture.orgId,
|
|
153
|
+
deviceUrl: webex.internal.device.url,
|
|
154
|
+
mercuryHostname: webex.internal.services._serviceUrls.mercuryApi
|
|
155
|
+
},
|
|
156
|
+
method: _types2.HTTP_METHODS.GET,
|
|
157
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId, "/").concat(_constants.CONTENT)
|
|
158
|
+
});
|
|
159
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
160
|
+
file: 'UcmBackendConnector',
|
|
161
|
+
method: _constants2.METHODS.GET_VOICEMAIL_CONTENT
|
|
162
|
+
});
|
|
163
|
+
expect(logSpy).toHaveBeenCalledWith("Successfully retrieved voicemail content with Message ID: ".concat(messageId), {
|
|
164
|
+
file: 'UcmBackendConnector',
|
|
165
|
+
method: 'getVoicemailContent'
|
|
166
|
+
});
|
|
167
|
+
case 2:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
170
|
+
}
|
|
171
|
+
}, _callee3);
|
|
172
|
+
})));
|
|
173
|
+
it('verify successful voicemailMarkAsRead', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
174
|
+
var response;
|
|
175
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
176
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
177
|
+
case 0:
|
|
178
|
+
webex.request.mockResolvedValueOnce(voicemailPayload);
|
|
179
|
+
_context4.next = 1;
|
|
180
|
+
return ucmBackendConnector.voicemailMarkAsRead(messageId);
|
|
181
|
+
case 1:
|
|
182
|
+
response = _context4.sent;
|
|
183
|
+
expect(response).toStrictEqual(responseDetails);
|
|
184
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
185
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
186
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
187
|
+
headers: {
|
|
188
|
+
orgId: _voicemailFixture.orgId
|
|
189
|
+
},
|
|
190
|
+
body: {
|
|
191
|
+
read: 'true'
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
195
|
+
file: 'UcmBackendConnector',
|
|
196
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_READ
|
|
197
|
+
});
|
|
198
|
+
expect(logSpy).toHaveBeenCalledWith('Successfully marked voicemail as read', {
|
|
199
|
+
file: 'UcmBackendConnector',
|
|
200
|
+
method: 'voicemailMarkAsRead'
|
|
201
|
+
});
|
|
202
|
+
case 2:
|
|
203
|
+
case "end":
|
|
204
|
+
return _context4.stop();
|
|
205
|
+
}
|
|
206
|
+
}, _callee4);
|
|
207
|
+
})));
|
|
208
|
+
it('verify successful voicemailMarkAsUnread', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
209
|
+
var response;
|
|
210
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
211
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
webex.request.mockResolvedValueOnce(voicemailPayload);
|
|
214
|
+
_context5.next = 1;
|
|
215
|
+
return ucmBackendConnector.voicemailMarkAsUnread(messageId);
|
|
216
|
+
case 1:
|
|
217
|
+
response = _context5.sent;
|
|
218
|
+
expect(response).toStrictEqual(responseDetails);
|
|
219
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
220
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
221
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
222
|
+
headers: {
|
|
223
|
+
orgId: _voicemailFixture.orgId
|
|
224
|
+
},
|
|
225
|
+
body: {
|
|
226
|
+
read: 'false'
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
230
|
+
file: 'UcmBackendConnector',
|
|
231
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_UNREAD
|
|
232
|
+
});
|
|
233
|
+
expect(logSpy).toHaveBeenCalledWith('Successfully marked voicemail as unread', {
|
|
234
|
+
file: 'UcmBackendConnector',
|
|
235
|
+
method: 'voicemailMarkAsUnread'
|
|
236
|
+
});
|
|
237
|
+
case 2:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context5.stop();
|
|
240
|
+
}
|
|
241
|
+
}, _callee5);
|
|
242
|
+
})));
|
|
243
|
+
it('verify successful deleteVoicemail', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
244
|
+
var response;
|
|
245
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
246
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
webex.request.mockResolvedValueOnce(voicemailPayload);
|
|
249
|
+
_context6.next = 1;
|
|
250
|
+
return ucmBackendConnector.deleteVoicemail(messageId);
|
|
251
|
+
case 1:
|
|
252
|
+
response = _context6.sent;
|
|
253
|
+
expect(response).toStrictEqual(responseDetails);
|
|
254
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
255
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
256
|
+
method: _types2.HTTP_METHODS.DELETE,
|
|
257
|
+
headers: {
|
|
258
|
+
orgId: _voicemailFixture.orgId
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
262
|
+
file: 'UcmBackendConnector',
|
|
263
|
+
method: _constants2.METHODS.DELETE_VOICEMAIL
|
|
264
|
+
});
|
|
265
|
+
expect(logSpy).toHaveBeenCalledWith('Successfully deleted voicemail', {
|
|
266
|
+
file: 'UcmBackendConnector',
|
|
267
|
+
method: 'deleteVoicemail'
|
|
268
|
+
});
|
|
269
|
+
case 2:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context6.stop();
|
|
272
|
+
}
|
|
273
|
+
}, _callee6);
|
|
274
|
+
})));
|
|
275
|
+
it('verify resolution of contact to null', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
276
|
+
var response;
|
|
277
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
278
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
279
|
+
case 0:
|
|
280
|
+
_context7.next = 1;
|
|
281
|
+
return ucmBackendConnector.resolveContact(_voicemailFixture.resolveContactArgs);
|
|
282
|
+
case 1:
|
|
283
|
+
response = _context7.sent;
|
|
284
|
+
expect(response).toBeNull();
|
|
285
|
+
expect(infoSpy).toHaveBeenCalledWith("Calling Party Info: ".concat(_voicemailFixture.resolveContactArgs), {});
|
|
286
|
+
case 2:
|
|
287
|
+
case "end":
|
|
288
|
+
return _context7.stop();
|
|
289
|
+
}
|
|
290
|
+
}, _callee7);
|
|
291
|
+
})));
|
|
292
|
+
});
|
|
293
|
+
describe('Voicemail failure tests for UCM', function () {
|
|
294
|
+
var responseDetails = {
|
|
295
|
+
statusCode: 400,
|
|
296
|
+
data: {
|
|
297
|
+
error: '400 Bad request'
|
|
298
|
+
},
|
|
299
|
+
message: _constants.FAILURE_MESSAGE
|
|
300
|
+
};
|
|
301
|
+
var responseDetails401 = {
|
|
302
|
+
statusCode: 401,
|
|
303
|
+
data: {
|
|
304
|
+
error: 'User is unauthorised, possible token expiry'
|
|
305
|
+
},
|
|
306
|
+
message: _constants.FAILURE_MESSAGE
|
|
307
|
+
};
|
|
308
|
+
var failurePayload = {
|
|
309
|
+
statusCode: 400
|
|
310
|
+
};
|
|
311
|
+
var failurePayload401 = {
|
|
312
|
+
statusCode: 401
|
|
313
|
+
};
|
|
314
|
+
beforeAll(function () {
|
|
315
|
+
webex.version = '2.31.1';
|
|
316
|
+
webex.internal.device.version = '2.31.1';
|
|
317
|
+
webex.internal.device.features.entitlement.models = [{
|
|
318
|
+
_values: {
|
|
319
|
+
key: 'ucm-calling'
|
|
320
|
+
}
|
|
321
|
+
}];
|
|
322
|
+
webex.internal.device.callingBehavior = 'NATIVE_SIP_CALL_TO_UCM';
|
|
323
|
+
ucmBackendConnector = new _UcmBackendConnector.UcmBackendConnector(webex, {
|
|
324
|
+
level: _types.LOGGER.INFO
|
|
325
|
+
});
|
|
326
|
+
ucmBackendConnector.init();
|
|
327
|
+
voicemailPayload = _voicemailFixture.getVoiceMailListJsonUCM;
|
|
328
|
+
});
|
|
329
|
+
beforeEach(function () {
|
|
330
|
+
serviceErrorCodeHandlerSpy = jest.spyOn(utils, 'serviceErrorCodeHandler');
|
|
331
|
+
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
332
|
+
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
333
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
334
|
+
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
335
|
+
});
|
|
336
|
+
afterEach(function () {
|
|
337
|
+
jest.clearAllMocks();
|
|
338
|
+
});
|
|
339
|
+
it('verify failure voicemail listing when bad request occur', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
340
|
+
var response;
|
|
341
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
342
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
343
|
+
case 0:
|
|
344
|
+
webex.request.mockRejectedValueOnce(failurePayload);
|
|
345
|
+
_context8.next = 1;
|
|
346
|
+
return ucmBackendConnector.getVoicemailList(0, 20, _types2.SORT.DESC);
|
|
347
|
+
case 1:
|
|
348
|
+
response = _context8.sent;
|
|
349
|
+
expect(response).toStrictEqual(responseDetails);
|
|
350
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
351
|
+
statusCode: 400
|
|
352
|
+
}, {
|
|
353
|
+
file: 'UcmBackendConnector',
|
|
354
|
+
method: 'getVoicemailList'
|
|
355
|
+
});
|
|
356
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
357
|
+
headers: {
|
|
358
|
+
orgId: _voicemailFixture.orgId
|
|
359
|
+
},
|
|
360
|
+
method: _types2.HTTP_METHODS.GET,
|
|
361
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl + _voicemailFixture.voicemailContent)
|
|
362
|
+
});
|
|
363
|
+
expect(infoSpy).toHaveBeenCalledWith('invoking with Offset: 0 Offset limit: 20 Sort type:DESC', {
|
|
364
|
+
file: 'UcmBackendConnector',
|
|
365
|
+
method: _constants2.METHODS.GET_VOICEMAIL_LIST
|
|
366
|
+
});
|
|
367
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
368
|
+
case 2:
|
|
369
|
+
case "end":
|
|
370
|
+
return _context8.stop();
|
|
371
|
+
}
|
|
372
|
+
}, _callee8);
|
|
373
|
+
})));
|
|
374
|
+
it('verify failure voicemailContent when bad request occur', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
375
|
+
var vmContentSpy, failurePayload422, response;
|
|
376
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
377
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
378
|
+
case 0:
|
|
379
|
+
vmContentSpy = jest.spyOn(ucmBackendConnector, 'getVoicemailContent');
|
|
380
|
+
failurePayload422 = {
|
|
381
|
+
statusCode: _constants.UNPROCESSABLE_CONTENT_CODE
|
|
382
|
+
};
|
|
383
|
+
webex.request.mockRejectedValue(failurePayload422);
|
|
384
|
+
_context9.next = 1;
|
|
385
|
+
return ucmBackendConnector.getVoicemailContent(messageId);
|
|
386
|
+
case 1:
|
|
387
|
+
response = _context9.sent;
|
|
388
|
+
expect(vmContentSpy).toBeCalledTimes(1);
|
|
389
|
+
expect(response).toStrictEqual(_voicemailFixture.responseDetails422);
|
|
390
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
391
|
+
statusCode: _constants.UNPROCESSABLE_CONTENT_CODE
|
|
392
|
+
}, {
|
|
393
|
+
file: 'UcmBackendConnector',
|
|
394
|
+
method: 'getVoicemailContent'
|
|
395
|
+
});
|
|
396
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
397
|
+
headers: {
|
|
398
|
+
orgId: _voicemailFixture.orgId,
|
|
399
|
+
deviceUrl: webex.internal.device.url,
|
|
400
|
+
mercuryHostname: webex.internal.services._serviceUrls.mercuryApi
|
|
401
|
+
},
|
|
402
|
+
method: _types2.HTTP_METHODS.GET,
|
|
403
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId, "/").concat(_constants.CONTENT)
|
|
404
|
+
});
|
|
405
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
406
|
+
file: 'UcmBackendConnector',
|
|
407
|
+
method: _constants2.METHODS.GET_VOICEMAIL_CONTENT
|
|
408
|
+
});
|
|
409
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
410
|
+
case 2:
|
|
411
|
+
case "end":
|
|
412
|
+
return _context9.stop();
|
|
413
|
+
}
|
|
414
|
+
}, _callee9);
|
|
415
|
+
})));
|
|
416
|
+
it('verify failure voicemailContent when failure voicemail api response received', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
417
|
+
var vmContentSpy, failureVoicemailResponse, response, failureVmResponseDetails;
|
|
418
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
419
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
420
|
+
case 0:
|
|
421
|
+
vmContentSpy = jest.spyOn(ucmBackendConnector, 'getVoicemailContent');
|
|
422
|
+
failureVoicemailResponse = {
|
|
423
|
+
statusCode: 204
|
|
424
|
+
};
|
|
425
|
+
webex.request.mockResolvedValueOnce(failureVoicemailResponse);
|
|
426
|
+
_context0.next = 1;
|
|
427
|
+
return ucmBackendConnector.getVoicemailContent(messageId);
|
|
428
|
+
case 1:
|
|
429
|
+
response = _context0.sent;
|
|
430
|
+
failureVmResponseDetails = _objectSpread({
|
|
431
|
+
data: {
|
|
432
|
+
voicemailContent: {
|
|
433
|
+
type: undefined,
|
|
434
|
+
content: undefined
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
message: _constants.FAILURE_MESSAGE
|
|
438
|
+
}, failureVoicemailResponse);
|
|
439
|
+
expect(vmContentSpy).toBeCalledTimes(1);
|
|
440
|
+
expect(response).toStrictEqual(_voicemailFixture.responseDetails204);
|
|
441
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith(failureVmResponseDetails, {
|
|
442
|
+
file: 'UcmBackendConnector',
|
|
443
|
+
method: 'getVoicemailContent'
|
|
444
|
+
});
|
|
445
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
446
|
+
headers: {
|
|
447
|
+
orgId: _voicemailFixture.orgId,
|
|
448
|
+
deviceUrl: webex.internal.device.url,
|
|
449
|
+
mercuryHostname: webex.internal.services._serviceUrls.mercuryApi
|
|
450
|
+
},
|
|
451
|
+
method: _types2.HTTP_METHODS.GET,
|
|
452
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId, "/").concat(_constants.CONTENT)
|
|
453
|
+
});
|
|
454
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
455
|
+
file: 'UcmBackendConnector',
|
|
456
|
+
method: _constants2.METHODS.GET_VOICEMAIL_CONTENT
|
|
457
|
+
});
|
|
458
|
+
case 2:
|
|
459
|
+
case "end":
|
|
460
|
+
return _context0.stop();
|
|
461
|
+
}
|
|
462
|
+
}, _callee0);
|
|
463
|
+
})));
|
|
464
|
+
it('verify failure voicemailMarkAsRead when bad request occur', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
465
|
+
var response;
|
|
466
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
467
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
468
|
+
case 0:
|
|
469
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
470
|
+
_context1.next = 1;
|
|
471
|
+
return ucmBackendConnector.voicemailMarkAsRead(messageId);
|
|
472
|
+
case 1:
|
|
473
|
+
response = _context1.sent;
|
|
474
|
+
expect(response).toStrictEqual(responseDetails);
|
|
475
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
476
|
+
statusCode: 400
|
|
477
|
+
}, {
|
|
478
|
+
file: 'UcmBackendConnector',
|
|
479
|
+
method: 'voicemailMarkAsRead'
|
|
480
|
+
});
|
|
481
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
482
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
483
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
484
|
+
headers: {
|
|
485
|
+
orgId: _voicemailFixture.orgId
|
|
486
|
+
},
|
|
487
|
+
body: {
|
|
488
|
+
read: 'true'
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
492
|
+
file: 'UcmBackendConnector',
|
|
493
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_READ
|
|
494
|
+
});
|
|
495
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
496
|
+
case 2:
|
|
497
|
+
case "end":
|
|
498
|
+
return _context1.stop();
|
|
499
|
+
}
|
|
500
|
+
}, _callee1);
|
|
501
|
+
})));
|
|
502
|
+
it('verify failure voicemailMarkAsUnread when bad request occur', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
503
|
+
var response;
|
|
504
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
505
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
506
|
+
case 0:
|
|
507
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
508
|
+
_context10.next = 1;
|
|
509
|
+
return ucmBackendConnector.voicemailMarkAsUnread(messageId);
|
|
510
|
+
case 1:
|
|
511
|
+
response = _context10.sent;
|
|
512
|
+
expect(response).toStrictEqual(responseDetails);
|
|
513
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
514
|
+
statusCode: 400
|
|
515
|
+
}, {
|
|
516
|
+
file: 'UcmBackendConnector',
|
|
517
|
+
method: 'voicemailMarkAsUnread'
|
|
518
|
+
});
|
|
519
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
520
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
521
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
522
|
+
headers: {
|
|
523
|
+
orgId: _voicemailFixture.orgId
|
|
524
|
+
},
|
|
525
|
+
body: {
|
|
526
|
+
read: 'false'
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
530
|
+
file: 'UcmBackendConnector',
|
|
531
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_UNREAD
|
|
532
|
+
});
|
|
533
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
534
|
+
case 2:
|
|
535
|
+
case "end":
|
|
536
|
+
return _context10.stop();
|
|
537
|
+
}
|
|
538
|
+
}, _callee10);
|
|
539
|
+
})));
|
|
540
|
+
it('verify failure delete voicemail when bad request occur', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
541
|
+
var response;
|
|
542
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
543
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
544
|
+
case 0:
|
|
545
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
546
|
+
_context11.next = 1;
|
|
547
|
+
return ucmBackendConnector.deleteVoicemail(messageId);
|
|
548
|
+
case 1:
|
|
549
|
+
response = _context11.sent;
|
|
550
|
+
expect(response).toStrictEqual(responseDetails);
|
|
551
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
552
|
+
statusCode: 400
|
|
553
|
+
}, {
|
|
554
|
+
file: 'UcmBackendConnector',
|
|
555
|
+
method: 'deleteVoicemail'
|
|
556
|
+
});
|
|
557
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
558
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
559
|
+
method: _types2.HTTP_METHODS.DELETE,
|
|
560
|
+
headers: {
|
|
561
|
+
orgId: _voicemailFixture.orgId
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
565
|
+
file: 'UcmBackendConnector',
|
|
566
|
+
method: _constants2.METHODS.DELETE_VOICEMAIL
|
|
567
|
+
});
|
|
568
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
569
|
+
case 2:
|
|
570
|
+
case "end":
|
|
571
|
+
return _context11.stop();
|
|
572
|
+
}
|
|
573
|
+
}, _callee11);
|
|
574
|
+
})));
|
|
575
|
+
it('verify failure voicemail listing when user is unauthorised, possible token expiry', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
576
|
+
var response;
|
|
577
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
578
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
579
|
+
case 0:
|
|
580
|
+
webex.request.mockRejectedValue(failurePayload401);
|
|
581
|
+
_context12.next = 1;
|
|
582
|
+
return ucmBackendConnector.getVoicemailList(0, 20, _types2.SORT.DESC);
|
|
583
|
+
case 1:
|
|
584
|
+
response = _context12.sent;
|
|
585
|
+
expect(response).toStrictEqual(responseDetails401);
|
|
586
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
587
|
+
statusCode: 401
|
|
588
|
+
}, {
|
|
589
|
+
file: 'UcmBackendConnector',
|
|
590
|
+
method: 'getVoicemailList'
|
|
591
|
+
});
|
|
592
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
593
|
+
headers: {
|
|
594
|
+
orgId: _voicemailFixture.orgId
|
|
595
|
+
},
|
|
596
|
+
method: _types2.HTTP_METHODS.GET,
|
|
597
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl + _voicemailFixture.voicemailContent)
|
|
598
|
+
});
|
|
599
|
+
expect(infoSpy).toHaveBeenCalledWith('invoking with Offset: 0 Offset limit: 20 Sort type:DESC', {
|
|
600
|
+
file: 'UcmBackendConnector',
|
|
601
|
+
method: _constants2.METHODS.GET_VOICEMAIL_LIST
|
|
602
|
+
});
|
|
603
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
604
|
+
case 2:
|
|
605
|
+
case "end":
|
|
606
|
+
return _context12.stop();
|
|
607
|
+
}
|
|
608
|
+
}, _callee12);
|
|
609
|
+
})));
|
|
610
|
+
it('verify failure voicemailMarkAsRead when user is unauthorised, possible token expiry', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
611
|
+
var response;
|
|
612
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
613
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
614
|
+
case 0:
|
|
615
|
+
webex.request.mockRejectedValue(failurePayload401);
|
|
616
|
+
_context13.next = 1;
|
|
617
|
+
return ucmBackendConnector.voicemailMarkAsRead(messageId);
|
|
618
|
+
case 1:
|
|
619
|
+
response = _context13.sent;
|
|
620
|
+
expect(response).toStrictEqual(responseDetails401);
|
|
621
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
622
|
+
statusCode: 401
|
|
623
|
+
}, {
|
|
624
|
+
file: 'UcmBackendConnector',
|
|
625
|
+
method: 'voicemailMarkAsRead'
|
|
626
|
+
});
|
|
627
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
628
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
629
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
630
|
+
headers: {
|
|
631
|
+
orgId: _voicemailFixture.orgId
|
|
632
|
+
},
|
|
633
|
+
body: {
|
|
634
|
+
read: 'true'
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
638
|
+
file: 'UcmBackendConnector',
|
|
639
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_READ
|
|
640
|
+
});
|
|
641
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
642
|
+
case 2:
|
|
643
|
+
case "end":
|
|
644
|
+
return _context13.stop();
|
|
645
|
+
}
|
|
646
|
+
}, _callee13);
|
|
647
|
+
})));
|
|
648
|
+
it('verify failure voicemailMarkAsUnread when user is unauthorised, possible token expiry', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
649
|
+
var response;
|
|
650
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
651
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
652
|
+
case 0:
|
|
653
|
+
webex.request.mockRejectedValue(failurePayload401);
|
|
654
|
+
_context14.next = 1;
|
|
655
|
+
return ucmBackendConnector.voicemailMarkAsUnread(messageId);
|
|
656
|
+
case 1:
|
|
657
|
+
response = _context14.sent;
|
|
658
|
+
expect(response).toStrictEqual(responseDetails401);
|
|
659
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
660
|
+
statusCode: 401
|
|
661
|
+
}, {
|
|
662
|
+
file: 'UcmBackendConnector',
|
|
663
|
+
method: 'voicemailMarkAsUnread'
|
|
664
|
+
});
|
|
665
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
666
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
667
|
+
method: _types2.HTTP_METHODS.PUT,
|
|
668
|
+
headers: {
|
|
669
|
+
orgId: _voicemailFixture.orgId
|
|
670
|
+
},
|
|
671
|
+
body: {
|
|
672
|
+
read: 'false'
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
676
|
+
file: 'UcmBackendConnector',
|
|
677
|
+
method: _constants2.METHODS.VOICEMAIL_MARK_AS_UNREAD
|
|
678
|
+
});
|
|
679
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
680
|
+
case 2:
|
|
681
|
+
case "end":
|
|
682
|
+
return _context14.stop();
|
|
683
|
+
}
|
|
684
|
+
}, _callee14);
|
|
685
|
+
})));
|
|
686
|
+
it('verify failure delete voicemail when user is unauthorised, possible token expiry', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
687
|
+
var response;
|
|
688
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
689
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
690
|
+
case 0:
|
|
691
|
+
webex.request.mockRejectedValue(failurePayload401);
|
|
692
|
+
_context15.next = 1;
|
|
693
|
+
return ucmBackendConnector.deleteVoicemail(messageId);
|
|
694
|
+
case 1:
|
|
695
|
+
response = _context15.sent;
|
|
696
|
+
expect(response).toStrictEqual(responseDetails401);
|
|
697
|
+
expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
|
|
698
|
+
statusCode: 401
|
|
699
|
+
}, {
|
|
700
|
+
file: 'UcmBackendConnector',
|
|
701
|
+
method: 'deleteVoicemail'
|
|
702
|
+
});
|
|
703
|
+
expect(webex.request).toBeCalledOnceWith({
|
|
704
|
+
uri: "".concat(_voicemailFixture.ucmBackendInfoUrl, "/").concat(messageId),
|
|
705
|
+
method: _types2.HTTP_METHODS.DELETE,
|
|
706
|
+
headers: {
|
|
707
|
+
orgId: _voicemailFixture.orgId
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants.METHOD_START_MESSAGE, " with Message ID: ").concat(messageId), {
|
|
711
|
+
file: 'UcmBackendConnector',
|
|
712
|
+
method: _constants2.METHODS.DELETE_VOICEMAIL
|
|
713
|
+
});
|
|
714
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
715
|
+
case 2:
|
|
716
|
+
case "end":
|
|
717
|
+
return _context15.stop();
|
|
718
|
+
}
|
|
719
|
+
}, _callee15);
|
|
720
|
+
})));
|
|
721
|
+
it('verify fetching voicemail summary returned to be null', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
722
|
+
var response;
|
|
723
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
724
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
725
|
+
case 0:
|
|
726
|
+
_context16.next = 1;
|
|
727
|
+
return ucmBackendConnector.getVoicemailSummary();
|
|
728
|
+
case 1:
|
|
729
|
+
response = _context16.sent;
|
|
730
|
+
expect(response).toBeNull();
|
|
731
|
+
case 2:
|
|
732
|
+
case "end":
|
|
733
|
+
return _context16.stop();
|
|
734
|
+
}
|
|
735
|
+
}, _callee16);
|
|
736
|
+
})));
|
|
737
|
+
});
|
|
738
|
+
//# sourceMappingURL=UcmBackendConnector.test.js.map
|