@webex/internal-plugin-mercury 3.0.0-next.7 → 3.0.0-next.8
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/mercury.js +1 -1
- package/package.json +17 -17
- package/test/unit/spec/mercury.js +8 -90
package/dist/mercury.js
CHANGED
|
@@ -435,7 +435,7 @@ var Mercury = _webexCore.WebexPlugin.extend((_dec = (0, _common.deprecated)('Mer
|
|
|
435
435
|
this.logger.info("".concat(this.namespace, ": reconnecting"));
|
|
436
436
|
return this.connect(webSocketUrl);
|
|
437
437
|
},
|
|
438
|
-
version: "3.0.0-next.
|
|
438
|
+
version: "3.0.0-next.8"
|
|
439
439
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "connect", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "connect"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "disconnect", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "disconnect"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "listen", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "listen"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "stopListening", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "stopListening"), _obj)), _obj)));
|
|
440
440
|
var _default = exports.default = Mercury;
|
|
441
441
|
//# sourceMappingURL=mercury.js.map
|
package/package.json
CHANGED
|
@@ -29,27 +29,27 @@
|
|
|
29
29
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
30
30
|
"@webex/jest-config-legacy": "0.0.0",
|
|
31
31
|
"@webex/legacy-tools": "0.0.0",
|
|
32
|
-
"@webex/test-helper-chai": "3.0.0-next.
|
|
33
|
-
"@webex/test-helper-mocha": "3.0.0-next.
|
|
34
|
-
"@webex/test-helper-mock-webex": "3.0.0-next.
|
|
35
|
-
"@webex/test-helper-test-users": "3.0.0-next.
|
|
32
|
+
"@webex/test-helper-chai": "3.0.0-next.7",
|
|
33
|
+
"@webex/test-helper-mocha": "3.0.0-next.7",
|
|
34
|
+
"@webex/test-helper-mock-webex": "3.0.0-next.7",
|
|
35
|
+
"@webex/test-helper-test-users": "3.0.0-next.7",
|
|
36
36
|
"eslint": "^8.24.0",
|
|
37
37
|
"prettier": "^2.7.1",
|
|
38
38
|
"sinon": "^9.2.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@webex/common": "3.0.0-next.
|
|
42
|
-
"@webex/common-timers": "3.0.0-next.
|
|
43
|
-
"@webex/internal-plugin-device": "3.0.0-next.
|
|
44
|
-
"@webex/internal-plugin-feature": "3.0.0-next.
|
|
45
|
-
"@webex/internal-plugin-metrics": "3.0.0-next.
|
|
46
|
-
"@webex/test-helper-chai": "3.0.0-next.
|
|
47
|
-
"@webex/test-helper-mocha": "3.0.0-next.
|
|
48
|
-
"@webex/test-helper-mock-web-socket": "3.0.0-next.
|
|
49
|
-
"@webex/test-helper-mock-webex": "3.0.0-next.
|
|
50
|
-
"@webex/test-helper-refresh-callback": "3.0.0-next.
|
|
51
|
-
"@webex/test-helper-test-users": "3.0.0-next.
|
|
52
|
-
"@webex/webex-core": "3.0.0-next.
|
|
41
|
+
"@webex/common": "3.0.0-next.7",
|
|
42
|
+
"@webex/common-timers": "3.0.0-next.7",
|
|
43
|
+
"@webex/internal-plugin-device": "3.0.0-next.7",
|
|
44
|
+
"@webex/internal-plugin-feature": "3.0.0-next.8",
|
|
45
|
+
"@webex/internal-plugin-metrics": "3.0.0-next.7",
|
|
46
|
+
"@webex/test-helper-chai": "3.0.0-next.7",
|
|
47
|
+
"@webex/test-helper-mocha": "3.0.0-next.7",
|
|
48
|
+
"@webex/test-helper-mock-web-socket": "3.0.0-next.7",
|
|
49
|
+
"@webex/test-helper-mock-webex": "3.0.0-next.7",
|
|
50
|
+
"@webex/test-helper-refresh-callback": "3.0.0-next.7",
|
|
51
|
+
"@webex/test-helper-test-users": "3.0.0-next.7",
|
|
52
|
+
"@webex/webex-core": "3.0.0-next.7",
|
|
53
53
|
"backoff": "^2.5.0",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"uuid": "^3.3.2",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"test:style": "eslint ./src/**/*.*",
|
|
65
65
|
"test:unit": "webex-legacy-tools test --unit --runner mocha"
|
|
66
66
|
},
|
|
67
|
-
"version": "3.0.0-next.
|
|
67
|
+
"version": "3.0.0-next.8"
|
|
68
68
|
}
|
|
@@ -745,99 +745,17 @@ describe('plugin-mercury', () => {
|
|
|
745
745
|
.then((wsUrl) => assert.match(wsUrl, /multipleConnections/)));
|
|
746
746
|
});
|
|
747
747
|
});
|
|
748
|
-
});
|
|
749
|
-
describe('ping pong latency event is forwarded', () => {
|
|
750
|
-
let clock, mercury, mockWebSocket, socketOpenStub, webex;
|
|
751
|
-
|
|
752
|
-
const statusStartTypingMessage = JSON.stringify({
|
|
753
|
-
id: uuid.v4(),
|
|
754
|
-
data: {
|
|
755
|
-
eventType: 'status.start_typing',
|
|
756
|
-
actor: {
|
|
757
|
-
id: 'actorId',
|
|
758
|
-
},
|
|
759
|
-
conversationId: uuid.v4(),
|
|
760
|
-
},
|
|
761
|
-
timestamp: Date.now(),
|
|
762
|
-
trackingId: `suffix_${uuid.v4()}_${Date.now()}`,
|
|
763
|
-
});
|
|
764
748
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
afterEach(() => {
|
|
770
|
-
clock.uninstall();
|
|
771
|
-
});
|
|
772
|
-
|
|
773
|
-
beforeEach(() => {
|
|
774
|
-
webex = new MockWebex({
|
|
775
|
-
children: {
|
|
776
|
-
mercury: Mercury,
|
|
777
|
-
},
|
|
778
|
-
});
|
|
779
|
-
webex.credentials = {
|
|
780
|
-
refresh: sinon.stub().returns(Promise.resolve()),
|
|
781
|
-
getUserToken: sinon.stub().returns(
|
|
782
|
-
Promise.resolve({
|
|
783
|
-
toString() {
|
|
784
|
-
return 'Bearer FAKE';
|
|
785
|
-
},
|
|
786
|
-
})
|
|
787
|
-
),
|
|
788
|
-
};
|
|
789
|
-
webex.internal.device = {
|
|
790
|
-
register: sinon.stub().returns(Promise.resolve()),
|
|
791
|
-
refresh: sinon.stub().returns(Promise.resolve()),
|
|
792
|
-
webSocketUrl: 'ws://example.com',
|
|
793
|
-
getWebSocketUrl: sinon.stub().returns(Promise.resolve('ws://example-2.com')),
|
|
794
|
-
useServiceCatalogUrl: sinon
|
|
795
|
-
.stub()
|
|
796
|
-
.returns(Promise.resolve('https://service-catalog-url.com')),
|
|
797
|
-
};
|
|
798
|
-
webex.internal.services = {
|
|
799
|
-
convertUrlToPriorityHostUrl: sinon.stub().returns(Promise.resolve('ws://example-2.com')),
|
|
800
|
-
markFailedUrl: sinon.stub().returns(Promise.resolve()),
|
|
801
|
-
};
|
|
802
|
-
webex.internal.metrics.submitClientMetrics = sinon.stub();
|
|
803
|
-
webex.trackingId = 'fakeTrackingId';
|
|
804
|
-
webex.config.mercury = mercuryConfig.mercury;
|
|
805
|
-
|
|
806
|
-
webex.logger = console;
|
|
807
|
-
|
|
808
|
-
mockWebSocket = new MockWebSocket();
|
|
809
|
-
sinon.stub(Socket, 'getWebSocketConstructor').returns(() => mockWebSocket);
|
|
810
|
-
|
|
811
|
-
const origOpen = Socket.prototype.open;
|
|
812
|
-
|
|
813
|
-
socketOpenStub = sinon.stub(Socket.prototype, 'open').callsFake(function (...args) {
|
|
814
|
-
const promise = Reflect.apply(origOpen, this, args);
|
|
815
|
-
|
|
816
|
-
process.nextTick(() => mockWebSocket.open());
|
|
817
|
-
|
|
818
|
-
return promise;
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
mercury = webex.internal.mercury;
|
|
822
|
-
});
|
|
823
|
-
|
|
824
|
-
afterEach(() => {
|
|
825
|
-
if (socketOpenStub) {
|
|
826
|
-
socketOpenStub.restore();
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
if (Socket.getWebSocketConstructor.restore) {
|
|
830
|
-
Socket.getWebSocketConstructor.restore();
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
it('should forward ping pong latency event', () => {
|
|
834
|
-
const spy = sinon.spy();
|
|
749
|
+
describe('ping pong latency event is forwarded', () => {
|
|
750
|
+
it('should forward ping pong latency event', () => {
|
|
751
|
+
const spy = sinon.spy();
|
|
835
752
|
|
|
836
|
-
|
|
753
|
+
mercury.on('ping-pong-latency', spy);
|
|
837
754
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
755
|
+
return mercury.connect().then(() => {
|
|
756
|
+
assert.calledWith(spy, 0);
|
|
757
|
+
assert.calledOnce(spy);
|
|
758
|
+
});
|
|
841
759
|
});
|
|
842
760
|
});
|
|
843
761
|
});
|