@webex/internal-plugin-dss 3.0.0 → 3.1.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/dss.js CHANGED
@@ -388,7 +388,7 @@ var DSS = _webexCore.WebexPlugin.extend({
388
388
  return _promise.default.reject(error);
389
389
  });
390
390
  },
391
- version: "3.0.0"
391
+ version: "3.1.0"
392
392
  });
393
393
  var _default = exports.default = DSS;
394
394
  //# sourceMappingURL=dss.js.map
package/package.json CHANGED
@@ -20,10 +20,10 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@webex/common": "3.0.0",
24
- "@webex/common-timers": "3.0.0",
25
- "@webex/internal-plugin-mercury": "3.0.0",
26
- "@webex/webex-core": "3.0.0",
23
+ "@webex/common": "3.1.0",
24
+ "@webex/common-timers": "3.1.0",
25
+ "@webex/internal-plugin-mercury": "3.1.0",
26
+ "@webex/webex-core": "3.1.0",
27
27
  "lodash": "^4.17.21",
28
28
  "uuid": "^3.3.2"
29
29
  },
@@ -33,9 +33,9 @@
33
33
  "@webex/eslint-config-legacy": "0.0.0",
34
34
  "@webex/jest-config-legacy": "0.0.0",
35
35
  "@webex/legacy-tools": "0.0.0",
36
- "@webex/test-helper-chai": "3.0.0",
37
- "@webex/test-helper-mock-webex": "3.0.0",
38
- "@webex/test-helper-test-users": "3.0.0",
36
+ "@webex/test-helper-chai": "3.1.0",
37
+ "@webex/test-helper-mock-webex": "3.1.0",
38
+ "@webex/test-helper-test-users": "3.1.0",
39
39
  "eslint": "^8.24.0",
40
40
  "prettier": "^2.7.1",
41
41
  "sinon": "^9.2.4"
@@ -49,5 +49,5 @@
49
49
  "test:style": "eslint ./src/**/*.*",
50
50
  "test:unit": "webex-legacy-tools test --unit --runner jest"
51
51
  },
52
- "version": "3.0.0"
52
+ "version": "3.1.0"
53
53
  }
@@ -241,22 +241,24 @@ describe('plugin-dss', () => {
241
241
  expect(result).to.be.null;
242
242
  });
243
243
  it('fails with default timeout when mercury does not respond', async () => {
244
- return testMakeRequest({
244
+ const {promise} = await testMakeRequest({
245
245
  method: 'lookupDetail',
246
246
  resource: '/lookup/orgid/userOrgId/identity/test id/detail',
247
247
  params: {id: 'test id'},
248
248
  bodyParams: {},
249
- }).then(async ({promise}) => {
250
- promise.catch((err) => {
251
- expect(err.toString()).equal(
252
- 'DssTimeoutError: The DSS did not respond within 6000 ms.' +
253
- '\n Request Id: randomid' +
254
- '\n Resource: /lookup/orgid/userOrgId/identity/test id/detail' +
255
- '\n Params: undefined'
256
- );
257
- });
258
- await clock.tickAsync(6000);
259
249
  });
250
+
251
+ promise.catch(() => {}); // to prevent the test from failing due to unhandled promise rejection
252
+
253
+ await clock.tickAsync(6000);
254
+
255
+ return assert.isRejected(
256
+ promise,
257
+ 'The DSS did not respond within 6000 ms.' +
258
+ '\n Request Id: randomid' +
259
+ '\n Resource: /lookup/orgid/userOrgId/identity/test id/detail' +
260
+ '\n Params: undefined'
261
+ );
260
262
  });
261
263
 
262
264
  it('does not fail with timeout when mercury response in time', async () => {
@@ -618,22 +620,24 @@ describe('plugin-dss', () => {
618
620
  });
619
621
 
620
622
  it('fails with default timeout when mercury does not respond', async () => {
621
- return testMakeRequest({
623
+ const {promise} = await testMakeRequest({
622
624
  method: 'lookup',
623
625
  resource: '/lookup/orgid/userOrgId/identities',
624
626
  params: {id: 'id1', shouldBatch: false},
625
627
  bodyParams: {lookupValues: ['id1']},
626
- }).then(async ({promise}) => {
627
- promise.catch((err) => {
628
- expect(err.toString()).equal(
629
- 'DssTimeoutError: The DSS did not respond within 6000 ms.' +
630
- '\n Request Id: randomid' +
631
- '\n Resource: /lookup/orgid/userOrgId/identities' +
632
- '\n Params: {"lookupValues":["id1"]}'
633
- );
634
- });
635
- await clock.tickAsync(6000);
636
628
  });
629
+
630
+ promise.catch(() => {}); // to prevent the test from failing due to unhandled promise rejection
631
+
632
+ await clock.tickAsync(6000);
633
+
634
+ return assert.isRejected(
635
+ promise,
636
+ 'The DSS did not respond within 6000 ms.' +
637
+ '\n Request Id: randomid' +
638
+ '\n Resource: /lookup/orgid/userOrgId/identities' +
639
+ '\n Params: {"lookupValues":["id1"]}'
640
+ );
637
641
  });
638
642
 
639
643
  it('does not fail with timeout when mercury response in time', async () => {
@@ -717,22 +721,24 @@ describe('plugin-dss', () => {
717
721
  });
718
722
 
719
723
  it('fails with default timeout when mercury does not respond', async () => {
720
- return testMakeRequest({
724
+ const {promise} = await testMakeRequest({
721
725
  method: 'lookupByEmail',
722
726
  resource: '/lookup/orgid/userOrgId/emails',
723
727
  params: {email: 'email1'},
724
728
  bodyParams: {lookupValues: ['email1']},
725
- }).then(async ({promise}) => {
726
- promise.catch((err) => {
727
- expect(err.toString()).equal(
728
- 'DssTimeoutError: The DSS did not respond within 6000 ms.' +
729
- '\n Request Id: randomid' +
730
- '\n Resource: /lookup/orgid/userOrgId/emails' +
731
- '\n Params: {"lookupValues":["email1"]}'
732
- );
733
- });
734
- await clock.tickAsync(6000);
735
729
  });
730
+
731
+ promise.catch(() => {}); // to prevent the test from failing due to unhandled promise rejection
732
+
733
+ await clock.tickAsync(6000);
734
+
735
+ return assert.isRejected(
736
+ promise,
737
+ 'The DSS did not respond within 6000 ms.' +
738
+ '\n Request Id: randomid' +
739
+ '\n Resource: /lookup/orgid/userOrgId/emails' +
740
+ '\n Params: {"lookupValues":["email1"]}'
741
+ );
736
742
  });
737
743
 
738
744
  it('does not fail with timeout when mercury response in time', async () => {
@@ -811,7 +817,7 @@ describe('plugin-dss', () => {
811
817
  });
812
818
 
813
819
  it('fails with default timeout when mercury does not respond', async () => {
814
- return testMakeRequest({
820
+ const {promise} = await testMakeRequest({
815
821
  method: 'search',
816
822
  resource: '/search/orgid/userOrgId/entities',
817
823
  params: {
@@ -824,17 +830,19 @@ describe('plugin-dss', () => {
824
830
  resultSize: 100,
825
831
  queryString: 'query',
826
832
  },
827
- }).then(async ({promise}) => {
828
- promise.catch((err) => {
829
- expect(err.toString()).equal(
830
- 'DssTimeoutError: The DSS did not respond within 6000 ms.' +
831
- '\n Request Id: randomid' +
832
- '\n Resource: /search/orgid/userOrgId/entities' +
833
- '\n Params: {"queryString":"query","resultSize":100,"requestedTypes":["PERSON","ROBOT"]}'
834
- );
835
- });
836
- await clock.tickAsync(6000);
837
833
  });
834
+
835
+ promise.catch(() => {}); // to prevent the test from failing due to unhandled promise rejection
836
+
837
+ await clock.tickAsync(6000);
838
+
839
+ return assert.isRejected(
840
+ promise,
841
+ 'The DSS did not respond within 6000 ms.' +
842
+ '\n Request Id: randomid' +
843
+ '\n Resource: /search/orgid/userOrgId/entities' +
844
+ '\n Params: {"queryString":"query","resultSize":100,"requestedTypes":["PERSON","ROBOT"]}'
845
+ );
838
846
  });
839
847
 
840
848
  it('does not fail with timeout when mercury response in time', async () => {
@@ -869,7 +877,7 @@ describe('plugin-dss', () => {
869
877
  });
870
878
 
871
879
  it('fails with timeout when request only partially resolved', async () => {
872
- return testMakeRequest({
880
+ const {requestId, promise} = await testMakeRequest({
873
881
  method: 'search',
874
882
  resource: '/search/orgid/userOrgId/entities',
875
883
  params: {
@@ -882,24 +890,26 @@ describe('plugin-dss', () => {
882
890
  resultSize: 100,
883
891
  queryString: 'query',
884
892
  },
885
- }).then(async ({requestId, promise}) => {
886
- mercuryCallbacks['event:directory.search'](
887
- createData(requestId, 2, true, 'directoryEntities', ['data2'])
888
- );
889
- mercuryCallbacks['event:directory.search'](
890
- createData(requestId, 0, false, 'directoryEntities', ['data0'])
891
- );
892
-
893
- promise.catch((err) => {
894
- expect(err.toString()).equal(
895
- 'DssTimeoutError: The DSS did not respond within 6000 ms.' +
896
- '\n Request Id: randomid' +
897
- '\n Resource: /search/orgid/userOrgId/entities' +
898
- '\n Params: {"queryString":"query","resultSize":100,"requestedTypes":["PERSON","ROBOT"]}'
899
- );
900
- });
901
- await clock.tickAsync(6000);
902
893
  });
894
+
895
+ mercuryCallbacks['event:directory.search'](
896
+ createData(requestId, 2, true, 'directoryEntities', ['data2'])
897
+ );
898
+ mercuryCallbacks['event:directory.search'](
899
+ createData(requestId, 0, false, 'directoryEntities', ['data0'])
900
+ );
901
+
902
+ promise.catch(() => {}); // to prevent the test from failing due to unhandled promise rejection
903
+
904
+ await clock.tickAsync(6000);
905
+
906
+ return assert.isRejected(
907
+ promise,
908
+ 'The DSS did not respond within 6000 ms.' +
909
+ '\n Request Id: randomid' +
910
+ '\n Resource: /search/orgid/userOrgId/entities' +
911
+ '\n Params: {"queryString":"query","resultSize":100,"requestedTypes":["PERSON","ROBOT"]}'
912
+ );
903
913
  });
904
914
  });
905
915
 
@@ -1155,7 +1165,7 @@ describe('plugin-dss', () => {
1155
1165
  expect(Batcher.prototype.request.getCall(1).args).to.deep.equal(['id2']);
1156
1166
  expect(result).to.equal(response2);
1157
1167
  });
1158
- // TODO
1168
+ // TODO - https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-518037
1159
1169
  it.skip('fails fails when mercury does not respond, later batches can still pass ok', async () => {
1160
1170
  // Batch 1
1161
1171
  const {