diff --git a/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js b/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js index 70a9d19a9d1..5594a57f77a 100644 --- a/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js +++ b/packages/@webex/internal-plugin-mercury/test/unit/spec/mercury.js @@ -745,99 +745,17 @@ describe('plugin-mercury', () => { .then((wsUrl) => assert.match(wsUrl, /multipleConnections/))); }); }); - }); - describe('ping pong latency event is forwarded', () => { - let clock, mercury, mockWebSocket, socketOpenStub, webex; - - const statusStartTypingMessage = JSON.stringify({ - id: uuid.v4(), - data: { - eventType: 'status.start_typing', - actor: { - id: 'actorId', - }, - conversationId: uuid.v4(), - }, - timestamp: Date.now(), - trackingId: `suffix_${uuid.v4()}_${Date.now()}`, - }); - beforeEach(() => { - clock = FakeTimers.install({now: Date.now()}); - }); - - afterEach(() => { - clock.uninstall(); - }); - - beforeEach(() => { - webex = new MockWebex({ - children: { - mercury: Mercury, - }, - }); - webex.credentials = { - refresh: sinon.stub().returns(Promise.resolve()), - getUserToken: sinon.stub().returns( - Promise.resolve({ - toString() { - return 'Bearer FAKE'; - }, - }) - ), - }; - webex.internal.device = { - register: sinon.stub().returns(Promise.resolve()), - refresh: sinon.stub().returns(Promise.resolve()), - webSocketUrl: 'ws://example.com', - getWebSocketUrl: sinon.stub().returns(Promise.resolve('ws://example-2.com')), - useServiceCatalogUrl: sinon - .stub() - .returns(Promise.resolve('https://service-catalog-url.com')), - }; - webex.internal.services = { - convertUrlToPriorityHostUrl: sinon.stub().returns(Promise.resolve('ws://example-2.com')), - markFailedUrl: sinon.stub().returns(Promise.resolve()), - }; - webex.internal.metrics.submitClientMetrics = sinon.stub(); - webex.trackingId = 'fakeTrackingId'; - webex.config.mercury = mercuryConfig.mercury; - - webex.logger = console; - - mockWebSocket = new MockWebSocket(); - sinon.stub(Socket, 'getWebSocketConstructor').returns(() => mockWebSocket); - - const origOpen = Socket.prototype.open; - - socketOpenStub = sinon.stub(Socket.prototype, 'open').callsFake(function (...args) { - const promise = Reflect.apply(origOpen, this, args); - - process.nextTick(() => mockWebSocket.open()); - - return promise; - }); - - mercury = webex.internal.mercury; - }); - - afterEach(() => { - if (socketOpenStub) { - socketOpenStub.restore(); - } - - if (Socket.getWebSocketConstructor.restore) { - Socket.getWebSocketConstructor.restore(); - } - }); - it('should forward ping pong latency event', () => { - const spy = sinon.spy(); + describe('ping pong latency event is forwarded', () => { + it('should forward ping pong latency event', () => { + const spy = sinon.spy(); - mercury.on('ping-pong-latency', spy); + mercury.on('ping-pong-latency', spy); - return mercury.connect().then(() => { - assert.calledWith(spy, 0); - assert.calledOnce(spy); + return mercury.connect().then(() => { + assert.calledWith(spy, 0); + assert.calledOnce(spy); + }); }); }); }); diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts index 5684e69e116..0bb673c8cb8 100644 --- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts @@ -361,9 +361,8 @@ describe('plugin-metrics', () => { }); }); - //TODO: The following two skipped tests needs investigation: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-485382 describe('when the request fails', () => { - it.skip('does not clear the queue', async () => { + it('does not clear the queue', async () => { // avoid setting .sent timestamp webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.prepareRequest = (q) => Promise.resolve(q); @@ -410,7 +409,7 @@ describe('plugin-metrics', () => { }); describe('prepareItem', () => { - it.skip('calls prepareDiagnosticMetricItem correctly', async () => { + it('calls prepareDiagnosticMetricItem correctly', async () => { // avoid setting .sent timestamp webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.prepareRequest = (q) => Promise.resolve(q); diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts index 43a76986d60..fccb9325244 100644 --- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts @@ -721,7 +721,7 @@ describe('internal-plugin-metrics', () => { ]); }); - it('should submit client event successfully with correlationId, webexConferenceIdStr and globalMeetingId', async () => { + it('should submit client event successfully with correlationId, webexConferenceIdStr and globalMeetingId', () => { const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent'); const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics'); const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload'); diff --git a/packages/@webex/internal-plugin-presence/test/unit/spec/presence-worker.js b/packages/@webex/internal-plugin-presence/test/unit/spec/presence-worker.js index 26a832d34aa..e3af5c1d9c9 100644 --- a/packages/@webex/internal-plugin-presence/test/unit/spec/presence-worker.js +++ b/packages/@webex/internal-plugin-presence/test/unit/spec/presence-worker.js @@ -16,7 +16,6 @@ describe.skip('presence-worker', () => { const id = '1234'; beforeEach(() => { - console.log(process.env.WEBEX_CLIENT_ID); webex = new MockWebex({ children: { mercury: Mercury, @@ -28,10 +27,31 @@ describe.skip('presence-worker', () => { }); describe('#initialize()', () => { - it('requires webex', () => - expect(() => worker.initialize()).toThrow(/Must initialize Presence Worker with webex!/)); - it('requires webex internal', () => - expect(() => worker.initialize({})).toThrow(/Must initialize Presence Worker with webex!/)); + it('requires webex', () =>{ + let err=null + try{ + worker.initialize() + } + catch(e){ + err=e + } + assert.equal(err?.message, 'Must initialize Presence Worker with webex!'); + + }); + + + it('requires webex internal', () =>{ + let err=null + try{ + worker.initialize({}) + } + catch(e){ + err=e + } + assert.equal(err?.message, 'Must initialize Presence Worker with webex!'); + + }); + }); // This selection of tests fail due to `webex-core`'s batcher config being missing.