@reltio/components 1.4.1997 → 1.4.1998

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.
Files changed (139) hide show
  1. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  2. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  3. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +267 -0
  4. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  5. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  6. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  7. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  8. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  9. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  10. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  11. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  12. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  13. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  14. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  15. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  16. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  17. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  18. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  19. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  20. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  21. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  22. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  23. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  24. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  25. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  26. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  27. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +784 -0
  28. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  29. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  30. package/cjs/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +102 -79
  31. package/cjs/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  32. package/cjs/features/activity-log/Field/Field.d.ts +2 -3
  33. package/cjs/features/activity-log/Field/Field.js +24 -2
  34. package/cjs/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  35. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  36. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.test.js +207 -0
  37. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  38. package/cjs/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  39. package/cjs/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  40. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  41. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  42. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +262 -0
  43. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  44. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  45. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  46. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  47. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  48. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  49. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  50. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  51. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  52. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  53. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  54. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  55. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  56. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  57. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  58. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  59. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  60. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  61. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  62. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  63. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  64. package/esm/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  65. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  66. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +779 -0
  67. package/esm/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  68. package/esm/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  69. package/esm/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +104 -58
  70. package/esm/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  71. package/esm/features/activity-log/Field/Field.d.ts +2 -3
  72. package/esm/features/activity-log/Field/Field.js +24 -2
  73. package/esm/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  74. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  75. package/esm/features/activity-log/RecordUpdates/RecordUpdates.test.js +202 -0
  76. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  77. package/esm/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  78. package/esm/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  79. package/package.json +1 -1
  80. package/cjs/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -142
  81. package/cjs/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -131
  82. package/cjs/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -252
  83. package/cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -158
  84. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -135
  85. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -65
  86. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  87. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -119
  88. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  89. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -75
  90. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  91. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -140
  92. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  93. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -41
  94. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  95. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -87
  96. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  97. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -19
  98. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  99. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -179
  100. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  101. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -150
  102. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  103. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -124
  104. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.d.ts +0 -1
  105. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -137
  106. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.d.ts +0 -1
  107. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -126
  108. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.d.ts +0 -1
  109. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -247
  110. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts +0 -1
  111. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -153
  112. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts +0 -1
  113. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -130
  114. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts +0 -1
  115. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -60
  116. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  117. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -114
  118. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  119. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -72
  120. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  121. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -135
  122. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  123. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -36
  124. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  125. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -82
  126. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  127. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -14
  128. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  129. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -151
  130. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  131. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -122
  132. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  133. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -119
  134. /package/cjs/features/activity-log/{ActivityExportButton/ActivityExportButton.specs.d.ts → ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  135. /package/cjs/features/activity-log/{ActivityFilterButton/ActivityFilterButton.specs.d.ts → ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  136. /package/cjs/features/activity-log/{ActivityFilterEditor/ActivityFilterEditor.specs.d.ts → RecordUpdates/RecordUpdates.test.d.ts} +0 -0
  137. /package/{cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts → esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  138. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts → esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  139. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts → esm/features/activity-log/RecordUpdates/RecordUpdates.test.d.ts} +0 -0
@@ -1,55 +1,76 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { PotentialMatchActivity } from './PotentialMatchActivity';
13
+ import { render, screen } from '@testing-library/react';
14
+ import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
4
15
  import { ActivityTypes } from '../../../types';
5
- import { CollapsibleActivityRecords } from '../../../CollapsibleActivityRecords';
6
- describe('PotentialMatchActivity tests', function () {
7
- var data = {
8
- uri: 'activities/EH.cee6a67a-7bcd-411f-9c19-3c796e44980b',
9
- user: 'IncrementalMatchThread',
10
- timestamp: 1621250963640,
11
- items: [
12
- {
13
- id: '89tO5t8I',
14
- user: 'IncrementalMatchThread',
15
- clientType: 'API',
16
- timestamp: 1621250963640,
17
- objectUri: 'entities/10hy6j0b',
18
- objectType: 'configuration/entityTypes/HCP',
19
- objectLabel: '- cBtCASwtAeEbTxe Agacati',
20
- data: {
21
- 'entities/11EunumT': '- cBtCASwtAeEbTxe Agacati',
22
- potentialMatches: 'entities/11EunumT',
23
- type: 'POTENTIAL_MATCHES_FOUND'
24
- },
25
- eventId: '1621250963640_02o1yQ8'
26
- },
27
- {
28
- id: '89tO5os2',
29
- user: 'IncrementalMatchThread',
30
- clientType: 'API',
31
- timestamp: 1621250963640,
32
- objectUri: 'entities/11EunumT',
33
- objectType: 'configuration/entityTypes/HCP',
34
- objectLabel: '- cBtCASwtAeEbTxe Agacati',
35
- data: {
36
- potentialMatches: 'entities/10hy6j0b,entities/a,entities/b,entities/c',
37
- type: 'POTENTIAL_MATCHES_FOUND',
38
- 'entities/10hy6j0b': '- cBtCASwtAeEbTxe Agacati',
39
- 'entities/a': 'first',
40
- 'entities/b': 'second',
41
- 'entities/c': 'third'
42
- },
43
- eventId: '1621250963640_02f5sXY'
16
+ import { CollapsibleItemsProvider } from '../../../contexts/CollapsibleItemsContext';
17
+ import { PotentialMatchActivity } from './PotentialMatchActivity';
18
+ var defaultData = {
19
+ uri: 'activities/156a1eda-4c2c-46e3-8550-118c500fb453',
20
+ user: 'marat.ahmetzyanov',
21
+ timestamp: 1620711408828,
22
+ items: [
23
+ {
24
+ id: '5C94p4Yp',
25
+ objectUri: 'entities/1PN94HrW',
26
+ objectLabel: 'item 1 label',
27
+ timestamp: 1620711408828,
28
+ data: {
29
+ type: ActivityTypes.ENTITIES_SPLITTED,
30
+ newUri: 'entities/sOoSQYm',
31
+ 'entities/sOoSQYm': 'item 1 entity label 1'
32
+ }
33
+ },
34
+ {
35
+ id: '72Jsk10Kl',
36
+ objectUri: 'entities/KsJmn28A',
37
+ objectLabel: 'item 2 label',
38
+ timestamp: 1620711404672,
39
+ data: {
40
+ type: ActivityTypes.POTENTIAL_MATCHES_FOUND,
41
+ potentialMatches: 'entities/sOoSQYm,entities/o92Bsm1',
42
+ 'entities/sOoSQYm': 'item 2 entity label 1',
43
+ 'entities/o92Bsm1': 'item 2 entity label 2'
44
44
  }
45
- ],
46
- itemsTotal: 2
45
+ }
46
+ ],
47
+ itemsTotal: 2
48
+ };
49
+ var defaultProps = {
50
+ data: defaultData,
51
+ type: ActivityTypes.ENTITIES_SPLITTED
52
+ };
53
+ var defaultMdmValues = {
54
+ uiPath: 'https://reltio.com/nui'
55
+ };
56
+ var setUp = function (_a) {
57
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
58
+ var Providers = function (_a) {
59
+ var children = _a.children;
60
+ return (React.createElement(MdmModuleProvider, { values: mdmValues },
61
+ React.createElement(CollapsibleItemsProvider, null, children)));
47
62
  };
63
+ return render(React.createElement(PotentialMatchActivity, __assign({}, props)), { wrapper: Providers });
64
+ };
65
+ describe('Potential match activity tests', function () {
48
66
  it('should render correctly', function () {
49
- var wrapper = shallow(React.createElement(PotentialMatchActivity, { type: ActivityTypes.POTENTIAL_MATCHES_FOUND, data: data }));
50
- expect(wrapper.find('ActivityTitle').prop('type')).toBe(ActivityTypes.POTENTIAL_MATCHES_FOUND);
51
- var collapsedActivity = wrapper.find(CollapsibleActivityRecords);
52
- expect(collapsedActivity.prop('activityUri')).toBe(data.uri);
53
- expect(collapsedActivity.prop('items')).toEqual(data.items);
67
+ setUp();
68
+ screen.getByText('Profile un-merged');
69
+ var records = screen.getAllByTestId('reltio-activity-log-record');
70
+ expect(records).toHaveLength(2);
71
+ expect(records[0]).toHaveTextContent('item 1 label');
72
+ expect(records[0]).toHaveTextContent('Un-merged with:item 1 entity label 1');
73
+ expect(records[1]).toHaveTextContent('item 2 label');
74
+ expect(records[1]).toHaveTextContent('Matches found:item 2 entity label 1, item 2 entity label 2');
54
75
  });
55
76
  });
@@ -7,7 +7,7 @@ export var ProfileActivity = function (_a) {
7
7
  var _b;
8
8
  var type = _a.type, data = _a.data;
9
9
  var isMinimized = data.itemsTotal === 1 && !((_b = data.items[0].deltaCollection) === null || _b === void 0 ? void 0 : _b.delta);
10
- return (React.createElement("div", null,
11
- React.createElement(ActivityTitle, { type: type }, isMinimized && React.createElement(EntityObject, { item: data.items[0] })),
10
+ return (React.createElement("div", { "data-reltio-id": "profile-activity" },
11
+ React.createElement(ActivityTitle, { type: type, "data-reltio-id": "profile-activity-title" }, isMinimized && React.createElement(EntityObject, { item: data.items[0] })),
12
12
  !isMinimized && (React.createElement(CollapsibleActivityRecords, { activityUri: data.uri, items: data.items, RecordComponent: EntityRecord }))));
13
13
  };
@@ -10,119 +10,135 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from 'react';
13
- import { shallow } from 'enzyme';
14
- import { ProfileActivity } from './ProfileActivity';
13
+ import { render, screen, within } from '@testing-library/react';
14
+ import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
15
15
  import { ActivityTypes } from '../../../types';
16
- import { CollapsibleActivityRecords } from '../../../CollapsibleActivityRecords';
17
- describe('ProfileActivity tests', function () {
18
- var data = {
19
- uri: 'activities/f0efd6b4-129b-4379-a37c-ac2c08e3f2a5',
20
- user: 'alexander.kirsanov',
21
- timestamp: 1622096971385,
22
- items: [
23
- {
24
- id: '30Y8UsZr',
25
- user: 'alexander.kirsanov',
26
- method: 'PUT',
27
- url: '/reltio/api/alenat/entities/k5nO0xA/attributes/TextField/3UIcE257b',
28
- clientType: 'Reltio UI',
29
- timestamp: 1622096971385,
30
- objectUri: 'entities/k5nO0xA',
31
- objectType: 'configuration/entityTypes/HCP',
32
- objectLabel: 'BulkUpdate_regression_3 Label_test_Long_label_test_long_long_long_long_long - RelationTableViewss - New Address for HCP_Bulk_Update with long_label Londomir',
33
- data: {
34
- type: 'ENTITY_CHANGED'
35
- },
36
- deltaCollection: {
37
- ovChanged: true,
38
- delta: [
39
- {
40
- type: 'ATTRIBUTE_CHANGED',
41
- attributeType: 'configuration/entityTypes/HCP/attributes/TextField',
42
- newValue: {
43
- value: 'Str31',
44
- ov: true,
45
- id: '3UIcE257b',
46
- sources: ['Reltio']
47
- },
48
- oldValue: {
49
- value: 'Str1',
50
- ov: true,
51
- id: '3UIcE257b',
52
- sources: ['Reltio']
53
- }
54
- }
55
- ]
56
- },
57
- eventId: '1622096971385_03DVkNW'
58
- },
59
- {
60
- id: '30Y8UsZr',
61
- user: 'alexander.kirsanov',
62
- method: 'PUT',
63
- url: '/reltio/api/alenat/entities/k5nO0xA/attributes/TextField/3UIcE257b',
64
- clientType: 'Reltio UI',
65
- timestamp: 1622096971385,
66
- objectUri: 'entities/k5nO0xA',
67
- objectType: 'configuration/entityTypes/HCP',
68
- objectLabel: 'BulkUpdate_regression_3 Label_test_Long_label_test_long_long_long_long_long - RelationTableViewss - New Address for HCP_Bulk_Update with long_label Londomir',
69
- data: {
70
- type: 'ENTITY_CHANGED'
71
- },
72
- deltaCollection: {
73
- ovChanged: true,
74
- delta: [
75
- {
76
- type: 'ATTRIBUTE_CHANGED',
77
- attributeType: 'configuration/entityTypes/HCP/attributes/TextField',
78
- newValue: {
79
- value: 'Str31',
80
- ov: true,
81
- id: '3UIcE257b',
82
- sources: ['Reltio']
83
- },
84
- oldValue: {
85
- value: 'Str1',
86
- ov: true,
87
- id: '3UIcE257b',
88
- sources: ['Reltio']
89
- }
90
- }
91
- ]
92
- },
93
- eventId: '1622096971385_03DVkNW'
94
- }
95
- ],
96
- itemsTotal: 1
97
- };
98
- var itemWithoutDelta = {
16
+ import { CollapsibleItemsProvider } from '../../../contexts/CollapsibleItemsContext';
17
+ import { ProfileActivity } from './ProfileActivity';
18
+ var defaultItems = [
19
+ {
99
20
  id: '30Y8UsZr',
100
- user: 'alexander.kirsanov',
101
- method: 'PUT',
102
- url: '/reltio/api/alenat/entities/k5nO0xA/attributes/TextField/3UIcE257b',
103
- clientType: 'Reltio UI',
104
21
  timestamp: 1622096971385,
105
22
  objectUri: 'entities/k5nO0xA',
106
23
  objectType: 'configuration/entityTypes/HCP',
107
- objectLabel: 'test',
108
- data: {
109
- type: 'ENTITY_CHANGED'
110
- },
24
+ objectLabel: 'item 1',
25
+ data: { type: ActivityTypes.ENTITY_CHANGED },
26
+ deltaCollection: {
27
+ ovChanged: true,
28
+ delta: [
29
+ {
30
+ type: 'ATTRIBUTE_CHANGED',
31
+ attributeType: 'configuration/entityTypes/HCP/attributes/TextField',
32
+ newValue: { value: 'new value', ov: true, id: '3UIcE257b', sources: ['Reltio'] },
33
+ oldValue: { value: 'old value', ov: true, id: '3UIcE257b', sources: ['Reltio'] }
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ {
39
+ id: 'o8NMgwA3',
40
+ timestamp: 1622096971385,
41
+ objectUri: 'entities/jD9maD2',
42
+ objectType: 'configuration/entityTypes/HCP',
43
+ objectLabel: 'item 2',
44
+ data: { type: ActivityTypes.ENTITY_CHANGED },
111
45
  deltaCollection: {
112
- ovChanged: false
113
- },
114
- eventId: '1622096971385_03DVkNW'
46
+ ovChanged: true,
47
+ delta: [
48
+ {
49
+ type: 'ATTRIBUTE_REMOVED',
50
+ attributeType: 'configuration/entityTypes/HCP/attributes/TextField',
51
+ oldValue: { value: 'removed value', ov: true, id: 'jd9SamA', sources: ['Reltio'] }
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ ];
57
+ var defaultData = {
58
+ uri: 'activities/f0efd6b4-129b-4379-a37c-ac2c08e3f2a5',
59
+ user: 'alexander.kirsanov',
60
+ timestamp: 1622096971385,
61
+ items: defaultItems,
62
+ itemsTotal: 2
63
+ };
64
+ var defaultProps = {
65
+ data: defaultData,
66
+ type: ActivityTypes.ENTITY_CHANGED
67
+ };
68
+ var defaultMdmValues = {
69
+ metadata: {
70
+ entityTypes: [
71
+ {
72
+ uri: 'configuration/entityTypes/HCP',
73
+ label: 'HCP',
74
+ attributes: [
75
+ {
76
+ label: 'String',
77
+ name: 'TextField',
78
+ type: 'String',
79
+ uri: 'configuration/entityTypes/HCP/attributes/TextField'
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ },
85
+ uiPath: 'https://reltio.com/nui'
86
+ };
87
+ var setUp = function (_a) {
88
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
89
+ var Providers = function (_a) {
90
+ var children = _a.children;
91
+ return (React.createElement(MdmModuleProvider, { values: mdmValues },
92
+ React.createElement(CollapsibleItemsProvider, null, children)));
115
93
  };
116
- it('should render correctly', function () {
117
- var wrapper = shallow(React.createElement(ProfileActivity, { type: ActivityTypes.ENTITY_CHANGED, data: data }));
118
- expect(wrapper.find('ActivityTitle').prop('type')).toBe(ActivityTypes.ENTITY_CHANGED);
119
- expect(wrapper.find('EntityObject').length).toBe(0);
120
- var collapsedActivity = wrapper.find(CollapsibleActivityRecords);
121
- expect(collapsedActivity.prop('activityUri')).toBe(data.uri);
122
- expect(collapsedActivity.prop('items')).toEqual(data.items);
123
- wrapper.setProps({ data: __assign(__assign({}, data), { items: [itemWithoutDelta] }) });
124
- expect(wrapper.find('ActivityTitle').prop('type')).toBe(ActivityTypes.ENTITY_CHANGED);
125
- expect(wrapper.find('EntityObject').length).toBe(1);
126
- expect(wrapper.find(CollapsibleActivityRecords)).toHaveLength(0);
94
+ return render(React.createElement(ProfileActivity, __assign({}, props)), { wrapper: Providers });
95
+ };
96
+ describe('Profile activity tests', function () {
97
+ it('should render minimized if itemsTotal is 1 and there is not delta field', function () {
98
+ var props = __assign(__assign({}, defaultProps), { data: __assign(__assign({}, defaultData), { items: [
99
+ {
100
+ id: '30Y8UsZr',
101
+ timestamp: 1622096971385,
102
+ objectUri: 'entities/k5nO0xA',
103
+ objectType: 'configuration/entityTypes/HCP',
104
+ objectLabel: 'item 1',
105
+ data: { type: ActivityTypes.ENTITY_CHANGED }
106
+ }
107
+ ], itemsTotal: 1 }) });
108
+ setUp({ props: props });
109
+ var title = screen.getByTestId('profile-activity-title');
110
+ within(title).getByText('item 1');
111
+ within(title).getByText('Profile updated');
112
+ expect(screen.queryByTestId('reltio-activity-log-record')).not.toBeInTheDocument();
113
+ });
114
+ it('should render maximized if itemsTotal is 1 but there is delta field', function () {
115
+ var props = __assign(__assign({}, defaultProps), { data: __assign(__assign({}, defaultData), { items: defaultItems.slice(0, 1), itemsTotal: 1 }) });
116
+ setUp({ props: props });
117
+ var title = screen.getByTestId('profile-activity-title');
118
+ within(title).getByText('Profile updated');
119
+ expect(within(title).queryByText('item 1')).not.toBeInTheDocument();
120
+ var record = screen.getByTestId('reltio-activity-log-record');
121
+ within(record).getByText('item 1');
122
+ expect(record).toHaveTextContent('String:');
123
+ expect(record).toHaveTextContent('old value');
124
+ expect(record).toHaveTextContent('new value');
125
+ expect(record).toHaveTextContent('edited');
126
+ });
127
+ it('should render maximized if itemsTotal is not 1', function () {
128
+ setUp();
129
+ var title = screen.getByTestId('profile-activity-title');
130
+ within(title).getByText('Profile updated');
131
+ expect(within(title).queryByText('item 1')).not.toBeInTheDocument();
132
+ expect(within(title).queryByText('item 2')).not.toBeInTheDocument();
133
+ var records = screen.getAllByTestId('reltio-activity-log-record');
134
+ within(records[0]).getByText('item 1');
135
+ expect(records[0]).toHaveTextContent('String:');
136
+ expect(records[0]).toHaveTextContent('old value');
137
+ expect(records[0]).toHaveTextContent('new value');
138
+ expect(records[0]).toHaveTextContent('edited');
139
+ within(records[1]).getByText('item 2');
140
+ expect(records[1]).toHaveTextContent('String:');
141
+ expect(records[1]).toHaveTextContent('removed value');
142
+ expect(records[1]).toHaveTextContent('deleted');
127
143
  });
128
144
  });
@@ -7,7 +7,7 @@ export var RelationActivity = function (_a) {
7
7
  var _b;
8
8
  var type = _a.type, data = _a.data;
9
9
  var isMinimized = data.itemsTotal === 1 && !((_b = data.items[0].deltaCollection) === null || _b === void 0 ? void 0 : _b.delta);
10
- return (React.createElement("div", null,
11
- React.createElement(ActivityTitle, { type: type }, isMinimized && React.createElement(RelationObject, { item: data.items[0] })),
10
+ return (React.createElement("div", { "data-reltio-id": "relation-activity" },
11
+ React.createElement(ActivityTitle, { type: type, "data-reltio-id": "relation-activity-title" }, isMinimized && React.createElement(RelationObject, { item: data.items[0] })),
12
12
  !isMinimized && (React.createElement(CollapsibleActivityRecords, { activityUri: data.uri, items: data.items, RecordComponent: RelationRecord }))));
13
13
  };
@@ -10,129 +10,142 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from 'react';
13
- import { shallow } from 'enzyme';
14
- import { RelationActivity } from './RelationActivity';
13
+ import { render, screen, within } from '@testing-library/react';
14
+ import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
15
15
  import { ActivityTypes } from '../../../types';
16
- import { CollapsibleActivityRecords } from '../../../CollapsibleActivityRecords';
17
- describe('RelationActivity tests', function () {
18
- var data = {
19
- uri: 'activities/4de656b9-e9c3-451d-8d3d-833c5a268268',
20
- user: 'egorshkov',
21
- timestamp: 1621250955807,
22
- items: [
23
- {
24
- id: '89tO5c5G',
25
- user: 'egorshkov',
26
- method: 'POST',
27
- url: '/reltio/api/alenat/entities/10hy6j0b/_update',
28
- clientType: 'Reltio UI',
29
- timestamp: 1621250955807,
30
- objectUri: 'relations/edEoxDC',
31
- objectType: 'configuration/relationTypes/HasAddress',
32
- startObjectUri: 'entities/10hy6j0b',
33
- startObjectLabel: '- cBtCASwtAeEbTxe Agacati',
34
- endObjectUri: 'entities/1BVkicLG',
35
- endObjectLabel: 'cBtCASwtAeEbTxe Agacati Nash',
36
- data: {
37
- type: 'RELATIONSHIP_CHANGED'
38
- },
39
- deltaCollection: {
40
- ovChanged: true,
41
- delta: [
42
- {
43
- type: 'ATTRIBUTE_CHANGED',
44
- attributeType: 'configuration/relationTypes/HasAddress/attributes/AddressType',
45
- newValue: {
46
- value: 'CLIN',
47
- ov: true,
48
- id: '2BY80NuxW',
49
- sources: ['Reltio']
50
- },
51
- oldValue: {
52
- value: 'BUSI',
53
- ov: true,
54
- id: '2BY80NuxW',
55
- sources: ['Reltio']
56
- }
57
- }
58
- ]
59
- },
60
- eventId: '1621250955807_025tRjR'
61
- },
62
- {
63
- id: '89tO5c5G',
64
- user: 'egorshkov',
65
- method: 'POST',
66
- url: '/reltio/api/alenat/entities/10hy6j0b/_update',
67
- clientType: 'Reltio UI',
68
- timestamp: 1621250955807,
69
- objectUri: 'relations/edEoxDC',
70
- objectType: 'configuration/relationTypes/HasAddress',
71
- startObjectUri: 'entities/10hy6j0b',
72
- startObjectLabel: '- cBtCASwtAeEbTxe Agacati',
73
- endObjectUri: 'entities/1BVkicLG',
74
- endObjectLabel: 'cBtCASwtAeEbTxe Agacati Nash',
75
- data: {
76
- type: 'RELATIONSHIP_CHANGED'
77
- },
78
- deltaCollection: {
79
- ovChanged: true,
80
- delta: [
81
- {
82
- type: 'ATTRIBUTE_CHANGED',
83
- attributeType: 'configuration/relationTypes/HasAddress/attributes/AddressType',
84
- newValue: {
85
- value: 'CLINS',
86
- ov: true,
87
- id: '2BY80NuxW',
88
- sources: ['Reltio']
89
- },
90
- oldValue: {
91
- value: 'BUSIQ',
92
- ov: true,
93
- id: '2BY80NuxW',
94
- sources: ['Reltio']
95
- }
96
- }
97
- ]
98
- },
99
- eventId: '1621250955807_025tRjR'
100
- }
101
- ],
102
- itemsTotal: 2
103
- };
104
- var itemWithoutDelta = {
16
+ import { CollapsibleItemsProvider } from '../../../contexts/CollapsibleItemsContext';
17
+ import { RelationActivity } from './RelationActivity';
18
+ var defaultItems = [
19
+ {
105
20
  id: '89tO5c5G',
106
- user: 'egorshkov',
107
- method: 'POST',
108
- url: '/reltio/api/alenat/entities/10hy6j0b/_update',
109
- clientType: 'Reltio UI',
110
21
  timestamp: 1621250955807,
111
22
  objectUri: 'relations/edEoxDC',
112
23
  objectType: 'configuration/relationTypes/HasAddress',
113
24
  startObjectUri: 'entities/10hy6j0b',
114
- startObjectLabel: '- cBtCASwtAeEbTxe Agacati',
25
+ startObjectLabel: 'item 1 start object label',
115
26
  endObjectUri: 'entities/1BVkicLG',
116
- endObjectLabel: 'cBtCASwtAeEbTxe Agacati Nash',
117
- data: {
118
- type: 'RELATIONSHIP_CHANGED'
119
- },
27
+ endObjectLabel: 'item 1 end object label',
28
+ data: { type: ActivityTypes.RELATIONSHIP_CHANGED },
29
+ deltaCollection: {
30
+ ovChanged: true,
31
+ delta: [
32
+ {
33
+ type: 'ATTRIBUTE_CHANGED',
34
+ attributeType: 'configuration/relationTypes/HasAddress/attributes/AddressType',
35
+ newValue: { value: 'CLIN', ov: true, id: 'yTn28IobS', sources: ['Reltio'] },
36
+ oldValue: { value: 'BUSI', ov: true, id: 'yTn28IobS', sources: ['Reltio'] }
37
+ }
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ id: '473Jsm3S',
43
+ timestamp: 1621250955807,
44
+ objectUri: 'relations/dK321SxZ',
45
+ objectType: 'configuration/relationTypes/HasAddress',
46
+ startObjectUri: 'entities/l28Nd2Zx',
47
+ startObjectLabel: 'item 2 start object label',
48
+ endObjectUri: 'entities/oP23Nsm3',
49
+ endObjectLabel: 'item 2 end object label',
50
+ data: { type: ActivityTypes.RELATIONSHIP_CHANGED },
120
51
  deltaCollection: {
121
- ovChanged: false,
122
- delta: undefined
123
- },
124
- eventId: '1621250955807_025tRjR'
52
+ ovChanged: true,
53
+ delta: [
54
+ {
55
+ type: 'ATTRIBUTE_CHANGED',
56
+ attributeType: 'configuration/relationTypes/HasAddress/attributes/AddressType',
57
+ newValue: { value: 'CLINS', ov: true, id: '2BY80NuxW', sources: ['Reltio'] },
58
+ oldValue: { value: 'BUSIQ', ov: true, id: '2BY80NuxW', sources: ['Reltio'] }
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ ];
64
+ var defaultData = {
65
+ uri: 'activities/f0efd6b4-129b-4379-a37c-ac2c08e3f2a5',
66
+ user: 'alexander.kirsanov',
67
+ timestamp: 1622096971385,
68
+ items: defaultItems,
69
+ itemsTotal: 2
70
+ };
71
+ var defaultProps = {
72
+ data: defaultData,
73
+ type: ActivityTypes.RELATIONSHIP_CHANGED
74
+ };
75
+ var defaultMdmValues = {
76
+ metadata: {
77
+ entityTypes: [],
78
+ relationTypes: [
79
+ {
80
+ uri: 'configuration/relationTypes/HasAddress',
81
+ label: 'Has address',
82
+ attributes: [
83
+ {
84
+ label: 'Address type',
85
+ name: 'AddressType',
86
+ type: 'String',
87
+ uri: 'configuration/relationTypes/HasAddress/attributes/AddressType'
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ },
93
+ uiPath: 'https://reltio.com/nui'
94
+ };
95
+ var setUp = function (_a) {
96
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
97
+ var Providers = function (_a) {
98
+ var children = _a.children;
99
+ return (React.createElement(MdmModuleProvider, { values: mdmValues },
100
+ React.createElement(CollapsibleItemsProvider, null, children)));
125
101
  };
126
- it('should render correctly', function () {
127
- var wrapper = shallow(React.createElement(RelationActivity, { type: ActivityTypes.RELATIONSHIP_CHANGED, data: data }));
128
- expect(wrapper.find('ActivityTitle').prop('type')).toBe(ActivityTypes.RELATIONSHIP_CHANGED);
129
- expect(wrapper.find('RelationObject').length).toBe(0);
130
- var collapsedActivity = wrapper.find(CollapsibleActivityRecords);
131
- expect(collapsedActivity.prop('activityUri')).toBe(data.uri);
132
- expect(collapsedActivity.prop('items')).toEqual(data.items);
133
- wrapper.setProps({ data: __assign(__assign({}, data), { items: [itemWithoutDelta], itemsTotal: 1 }) });
134
- expect(wrapper.find('ActivityTitle').prop('type')).toBe(ActivityTypes.RELATIONSHIP_CHANGED);
135
- expect(wrapper.find('RelationObject').length).toBe(1);
136
- expect(wrapper.find(CollapsibleActivityRecords)).toHaveLength(0);
102
+ return render(React.createElement(RelationActivity, __assign({}, props)), { wrapper: Providers });
103
+ };
104
+ describe('Relation activity tests', function () {
105
+ it('should render minimized if itemsTotal is 1 and there is not delta field', function () {
106
+ var props = __assign(__assign({}, defaultProps), { data: __assign(__assign({}, defaultData), { items: [__assign(__assign({}, defaultItems[0]), { deltaCollection: undefined })], itemsTotal: 1 }) });
107
+ setUp({ props: props });
108
+ var title = screen.getByTestId('relation-activity-title');
109
+ within(title).getByText('item 1 start object label');
110
+ within(title).getByText('item 1 end object label');
111
+ within(title).getByText('Relationship updated');
112
+ expect(screen.queryByTestId('reltio-activity-log-record')).not.toBeInTheDocument();
113
+ });
114
+ it('should render maximized if itemsTotal is 1 but there is delta field', function () {
115
+ var props = __assign(__assign({}, defaultProps), { data: __assign(__assign({}, defaultData), { items: defaultItems.slice(0, 1), itemsTotal: 1 }) });
116
+ setUp({ props: props });
117
+ var title = screen.getByTestId('relation-activity-title');
118
+ within(title).getByText('Relationship updated');
119
+ expect(within(title).queryByText('item 1 start object label')).not.toBeInTheDocument();
120
+ expect(within(title).queryByText('item 1 end object label')).not.toBeInTheDocument();
121
+ var record = screen.getByTestId('reltio-activity-log-record');
122
+ within(record).getByText('item 1 start object label');
123
+ within(record).getByText('item 1 end object label');
124
+ expect(record).toHaveTextContent('Address type:');
125
+ expect(record).toHaveTextContent('BUSI');
126
+ expect(record).toHaveTextContent('CLIN');
127
+ expect(record).toHaveTextContent('edited');
128
+ });
129
+ it('should render maximized if itemsTotal is not 1', function () {
130
+ setUp();
131
+ var title = screen.getByTestId('relation-activity-title');
132
+ within(title).getByText('Relationship updated');
133
+ expect(within(title).queryByText('item 1 start object label')).not.toBeInTheDocument();
134
+ expect(within(title).queryByText('item 1 end object label')).not.toBeInTheDocument();
135
+ expect(within(title).queryByText('item 2 start object label')).not.toBeInTheDocument();
136
+ expect(within(title).queryByText('item 2 end object label')).not.toBeInTheDocument();
137
+ var records = screen.getAllByTestId('reltio-activity-log-record');
138
+ within(records[0]).getByText('item 1 start object label');
139
+ within(records[0]).getByText('item 1 end object label');
140
+ expect(records[0]).toHaveTextContent('Address type:');
141
+ expect(records[0]).toHaveTextContent('BUSI');
142
+ expect(records[0]).toHaveTextContent('CLIN');
143
+ expect(records[0]).toHaveTextContent('edited');
144
+ within(records[1]).getByText('item 2 start object label');
145
+ within(records[1]).getByText('item 2 end object label');
146
+ expect(records[1]).toHaveTextContent('Address type:');
147
+ expect(records[1]).toHaveTextContent('BUSIQ');
148
+ expect(records[1]).toHaveTextContent('CLINS');
149
+ expect(records[1]).toHaveTextContent('edited');
137
150
  });
138
151
  });