@reltio/components 1.4.1996 → 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 (141) hide show
  1. package/cjs/ResizablePanes/ResizablePanes.js +5 -6
  2. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  3. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  4. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +267 -0
  5. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  6. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  7. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  8. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  9. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  10. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  11. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  12. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  13. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  14. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  15. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  16. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  17. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  18. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  19. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  20. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  21. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  22. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  23. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  24. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  25. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  26. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  27. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  28. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +784 -0
  29. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  30. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  31. package/cjs/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +102 -79
  32. package/cjs/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  33. package/cjs/features/activity-log/Field/Field.d.ts +2 -3
  34. package/cjs/features/activity-log/Field/Field.js +24 -2
  35. package/cjs/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  36. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  37. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.test.js +207 -0
  38. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  39. package/cjs/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  40. package/cjs/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  41. package/esm/ResizablePanes/ResizablePanes.js +5 -6
  42. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  43. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  44. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +262 -0
  45. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  46. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  47. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  48. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  49. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  50. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  51. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  52. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  53. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  54. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  55. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  56. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  57. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  58. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  59. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  60. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  61. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  62. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  63. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  64. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  65. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  66. package/esm/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  67. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  68. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +779 -0
  69. package/esm/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  70. package/esm/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  71. package/esm/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +104 -58
  72. package/esm/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  73. package/esm/features/activity-log/Field/Field.d.ts +2 -3
  74. package/esm/features/activity-log/Field/Field.js +24 -2
  75. package/esm/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  76. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  77. package/esm/features/activity-log/RecordUpdates/RecordUpdates.test.js +202 -0
  78. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  79. package/esm/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  80. package/esm/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  81. package/package.json +1 -1
  82. package/cjs/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -142
  83. package/cjs/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -131
  84. package/cjs/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -252
  85. package/cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -158
  86. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -135
  87. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -65
  88. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  89. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -119
  90. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  91. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -75
  92. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  93. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -140
  94. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  95. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -41
  96. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  97. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -87
  98. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  99. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -19
  100. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  101. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -179
  102. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  103. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -150
  104. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  105. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -124
  106. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.d.ts +0 -1
  107. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -137
  108. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.d.ts +0 -1
  109. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -126
  110. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.d.ts +0 -1
  111. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -247
  112. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts +0 -1
  113. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -153
  114. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts +0 -1
  115. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -130
  116. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts +0 -1
  117. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -60
  118. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  119. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -114
  120. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  121. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -72
  122. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  123. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -135
  124. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  125. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -36
  126. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  127. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -82
  128. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  129. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -14
  130. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  131. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -151
  132. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  133. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -122
  134. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  135. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -119
  136. /package/cjs/features/activity-log/{ActivityExportButton/ActivityExportButton.specs.d.ts → ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  137. /package/cjs/features/activity-log/{ActivityFilterButton/ActivityFilterButton.specs.d.ts → ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  138. /package/cjs/features/activity-log/{ActivityFilterEditor/ActivityFilterEditor.specs.d.ts → RecordUpdates/RecordUpdates.test.d.ts} +0 -0
  139. /package/{cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts → esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  140. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts → esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  141. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts → esm/features/activity-log/RecordUpdates/RecordUpdates.test.d.ts} +0 -0
@@ -1,135 +0,0 @@
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
- };
12
- import React from 'react';
13
- import i18n from 'ui-i18n';
14
- import { render, screen } from '@testing-library/react';
15
- import { CollapsibleItemsProvider } from '../../../contexts/CollapsibleItemsContext';
16
- import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
17
- import { ActivityItem } from './ActivityItem';
18
- describe('ActivityItem tests', function () {
19
- var props = {
20
- item: {
21
- uri: 'activities/e87a3fa5-19e5-4f6c-a5eb-ef296ffb6200',
22
- user: 'alexander.kirsanov',
23
- timestamp: 1625651146042,
24
- items: [
25
- {
26
- id: '5kDR6w7P',
27
- user: 'alexander.kirsanov',
28
- method: 'POST',
29
- url: '/reltio/api/sokol/entities/_same',
30
- clientType: 'Reltio UI',
31
- timestamp: 1625651146042,
32
- objectUri: 'entities/11B3njW5',
33
- objectType: 'configuration/entityTypes/Contact',
34
- objectLabel: 'Child',
35
- data: {
36
- mergeReason: 'Merge by hand',
37
- mergeType: 'MANUAL',
38
- potentialMatches: 'entities/1af0Kc9A',
39
- type: 'ENTITIES_MERGED_MANUALLY',
40
- 'entities/1af0Kc9A': 'William3'
41
- },
42
- eventId: '1625651146042_0hX0z4v'
43
- },
44
- {
45
- id: '5kDR78uB',
46
- user: 'alexander.kirsanov',
47
- method: 'POST',
48
- url: '/reltio/api/sokol/entities/_same',
49
- clientType: 'Reltio UI',
50
- timestamp: 1625651146042,
51
- objectUri: 'entities/1af0Kc9A',
52
- objectType: 'configuration/entityTypes/Contact',
53
- objectLabel: 'William3',
54
- data: {
55
- type: 'ENTITY_LOST_MERGE'
56
- },
57
- eventId: '1625651146042_0hPzNV9'
58
- },
59
- {
60
- id: '5kDR70Nf',
61
- user: 'alexander.kirsanov',
62
- method: 'POST',
63
- url: '/reltio/api/sokol/entities/_same',
64
- clientType: 'Reltio UI',
65
- timestamp: 1625651146042,
66
- objectUri: 'relations/1Jp4lDRt',
67
- objectType: 'configuration/relationTypes/Parent',
68
- startObjectUri: 'entities/1af0Kc9A',
69
- startObjectLabel: 'William3',
70
- endObjectUri: 'entities/11B3nnmL',
71
- endObjectLabel: 'William3',
72
- data: {
73
- type: 'RELATIONSHIP_CHANGED'
74
- },
75
- deltaCollection: {
76
- ovChanged: false
77
- },
78
- eventId: '1625651146042_0hEd1VD'
79
- },
80
- {
81
- id: '5kDR74dv',
82
- user: 'alexander.kirsanov',
83
- method: 'POST',
84
- url: '/reltio/api/sokol/entities/_same',
85
- clientType: 'Reltio UI',
86
- timestamp: 1625651146042,
87
- objectUri: 'entities/11B3njW5',
88
- objectType: 'configuration/entityTypes/Contact',
89
- objectLabel: 'William1',
90
- data: {
91
- type: 'ENTITY_CHANGED'
92
- },
93
- deltaCollection: {
94
- ovChanged: true,
95
- delta: [
96
- {
97
- type: 'ATTRIBUTE_CHANGED',
98
- attributeType: 'configuration/entityTypes/Contact/attributes/Name',
99
- newValue: {
100
- value: 'Child',
101
- ov: false,
102
- id: '4AgJ4ZWFq',
103
- sources: ['Reltio']
104
- },
105
- oldValue: {
106
- value: 'Child',
107
- ov: true,
108
- id: '4AgJ4ZWFq',
109
- sources: ['Reltio']
110
- }
111
- }
112
- ]
113
- },
114
- eventId: '1625651146042_0hsNu3t'
115
- }
116
- ],
117
- itemsTotal: 4
118
- }
119
- };
120
- it('should render correctly', function () {
121
- var metadata = { entityTypes: [] };
122
- var Providers = function (_a) {
123
- var children = _a.children;
124
- return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
125
- React.createElement(CollapsibleItemsProvider, null, children)));
126
- };
127
- render(React.createElement(ActivityItem, __assign({}, props)), { wrapper: Providers });
128
- expect(screen.getByText(props.item.user)).toBeInTheDocument();
129
- expect(screen.getByText(i18n.date(props.item.timestamp, 'LT'))).toBeInTheDocument();
130
- expect(screen.getByText('Profile merged manually')).toBeInTheDocument();
131
- expect(screen.getByText('Profile lost merge')).toBeInTheDocument();
132
- expect(screen.getByText('Relationship updated')).toBeInTheDocument();
133
- expect(screen.getByText('Profile updated')).toBeInTheDocument();
134
- });
135
- });
@@ -1,36 +0,0 @@
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
- };
12
- import React from 'react';
13
- import i18n from 'ui-i18n';
14
- import { shallow } from 'enzyme';
15
- import { GroupItem } from './GroupItem';
16
- describe('GroupItem tests', function () {
17
- var props = {
18
- item: {
19
- collapsed: false,
20
- index: 0,
21
- timestamp: 12345
22
- },
23
- onToggle: jest.fn()
24
- };
25
- it('should render correctly', function () {
26
- var wrapper = shallow(React.createElement(GroupItem, __assign({}, props)));
27
- expect(wrapper.find('.groupIcon')).toHaveLength(1);
28
- expect(wrapper.find('.groupTitle').text()).toBe(i18n.date(props.item.timestamp, 'LL'));
29
- expect(wrapper.find('CollapseButton').prop('isOpen')).toBe(true);
30
- });
31
- it('should call props.onToggle on collapse button click', function () {
32
- var wrapper = shallow(React.createElement(GroupItem, __assign({}, props)));
33
- wrapper.find('CollapseButton').simulate('click');
34
- expect(props.onToggle).toHaveBeenCalledWith(props.item.index);
35
- });
36
- });
@@ -1,82 +0,0 @@
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
- };
12
- import React from 'react';
13
- import { mount } from 'enzyme';
14
- import { getAllUsersForTenant, canUserMakeActivitiesExport, DateRangeTypes } from '@reltio/mdm-sdk';
15
- import Tooltip from '@mui/material/Tooltip';
16
- import { ActivityLogFilter } from './ActivityLogFilter';
17
- import { ActivityExportButton } from '../ActivityExportButton';
18
- import { ActivityFilterButton } from '../ActivityFilterButton';
19
- import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
20
- jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getAllUsersForTenant: jest.fn(), canUserMakeActivitiesExport: jest.fn() })); });
21
- jest.mock('../ActivityExportButton', function () { return ({
22
- ActivityExportButton: function () { return null; }
23
- }); });
24
- jest.mock('../ActivityFilterButton', function () { return ({
25
- ActivityFilterButton: function () { return null; }
26
- }); });
27
- var defaultValue = {
28
- users: [],
29
- activities: [],
30
- dateRange: {
31
- type: DateRangeTypes.WITHIN,
32
- period: [4, 'months']
33
- }
34
- };
35
- var defaultProps = {
36
- value: defaultValue,
37
- entityType: {
38
- uri: 'configuration/entityTypes/Contact',
39
- label: 'Contact',
40
- attributes: []
41
- },
42
- onChange: jest.fn(),
43
- exportTypes: ['csv'],
44
- entityUri: 'entity/123'
45
- };
46
- var setUp = function (_a) {
47
- var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c;
48
- return mount(React.createElement(MdmModuleProvider, null,
49
- React.createElement(ActivityLogFilter, __assign({}, props))));
50
- };
51
- describe('ActivitiesLogFilter tests', function () {
52
- var users = [
53
- { username: 'username1', email: 'email1' },
54
- { username: 'username2', email: 'email2' }
55
- ];
56
- beforeAll(function () {
57
- getAllUsersForTenant.mockResolvedValue(users);
58
- canUserMakeActivitiesExport.mockReturnValue(true);
59
- });
60
- it('should render correct default state', function () {
61
- var wrapper = setUp();
62
- var activityExportButton = wrapper.find(ActivityExportButton);
63
- var activityFilterButton = wrapper.find(ActivityFilterButton);
64
- expect(activityExportButton.props()).toMatchObject({
65
- filters: __assign(__assign({}, defaultProps.value), { entityUri: defaultProps.entityUri }),
66
- exportTypes: defaultProps.exportTypes
67
- });
68
- expect(activityFilterButton.props()).toMatchObject({
69
- filter: defaultProps.value,
70
- entityType: defaultProps.entityType,
71
- onChange: defaultProps.onChange
72
- });
73
- expect(wrapper.find('p').find('.label').at(0).text()).toBe('Filter:');
74
- expect(wrapper.find(Tooltip).prop('title')).toBe('Within 4 months');
75
- expect(wrapper.find('p').find('.label').at(1).text()).toBe('Within 4 months');
76
- });
77
- it('should not render export button when there are no permissions', function () {
78
- canUserMakeActivitiesExport.mockReturnValue(false);
79
- var wrapper = setUp();
80
- expect(wrapper.find(ActivityExportButton).length).toBe(0);
81
- });
82
- });
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { ActivityTitle } from './ActivityTitle';
4
- import { getActivityLabel } from '../utils/activities';
5
- import { ActivityTypes } from '../types';
6
- describe('ActivityTitle tests', function () {
7
- it('should render correctly', function () {
8
- var wrapper = shallow(React.createElement(ActivityTitle, { type: ActivityTypes.USER_LOGIN },
9
- React.createElement("div", { className: "test" })));
10
- expect(wrapper.find('.activityTitle').length).toBe(1);
11
- expect(wrapper.find('.activityType').text()).toBe(getActivityLabel(ActivityTypes.USER_LOGIN));
12
- expect(wrapper.find('.test').length).toBe(1);
13
- });
14
- });
@@ -1,151 +0,0 @@
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
- };
12
- import React from 'react';
13
- import { act } from 'react-dom/test-utils';
14
- import { mount, shallow } from 'enzyme';
15
- import i18n from 'ui-i18n';
16
- import * as collapsibleItemsContext from '../../../contexts/CollapsibleItemsContext';
17
- import { MoreItemsLink } from '../../../MoreItemsLink';
18
- import { PotentialMatchField } from './PotentialMatchField';
19
- describe('PotentialMatchField tests', function () {
20
- var item = {
21
- id: '3LfWvJHo',
22
- user: 'IncrementalMatchThread',
23
- clientType: 'API',
24
- timestamp: 1621847092199,
25
- objectUri: 'entities/sOoSQYm',
26
- objectType: 'configuration/entityTypes/HCP',
27
- objectLabel: '- cBtCASwtAeEbTxe Agacati',
28
- data: {
29
- 'entities/11EunumT': '- cBtCASwtAeEbTxe Agacati',
30
- potentialMatches: 'entities/11EunumT,entities/10hy6j0b',
31
- type: 'POTENTIAL_MATCHES_FOUND',
32
- 'entities/10hy6j0b': '- cBtCASwtAeEbTx1 Agacati'
33
- },
34
- eventId: '1621847092199_00bgtiZ'
35
- };
36
- var values = [
37
- { uri: 'entities/11EunumT', label: '- cBtCASwtAeEbTxe Agacati' },
38
- { uri: 'entities/10hy6j0b', label: '- cBtCASwtAeEbTx1 Agacati' }
39
- ];
40
- var onExpand = jest.fn();
41
- var useCollapsibleItems = jest.spyOn(collapsibleItemsContext, 'useCollapsibleItems');
42
- it('should render correctly for potentialMatches', function () {
43
- useCollapsibleItems.mockImplementation(function () { return ({
44
- itemsToShow: item.data.potentialMatches.split(','),
45
- onExpand: onExpand,
46
- collapsedItemsCount: 0
47
- }); });
48
- var wrapper = mount(React.createElement(PotentialMatchField, { item: item }));
49
- expect(wrapper.find('.fieldName').text()).toBe('Matches found:');
50
- var links = wrapper.find('EntityUriLink');
51
- expect(links.length).toBe(2);
52
- links.forEach(function (item, i) {
53
- expect(item.prop('value')).toBe(values[i].uri);
54
- expect(item.text()).toBe(values[i].label);
55
- });
56
- });
57
- it('should render correctly for newUri', function () {
58
- var newUriItem = __assign(__assign({}, item), { data: {
59
- 'entities/2eIQy30G': 'HCP DT 2,',
60
- newUri: 'entities/2eIQy30G',
61
- type: 'ENTITIES_SPLITTED'
62
- } });
63
- useCollapsibleItems.mockImplementation(function () { return ({
64
- itemsToShow: newUriItem.data.newUri.split(','),
65
- onExpand: onExpand,
66
- collapsedItemsCount: 0
67
- }); });
68
- var wrapper = mount(React.createElement(PotentialMatchField, { item: newUriItem }));
69
- expect(wrapper.find('.fieldName').text()).toBe('Un-merged with:');
70
- var link = wrapper.find('EntityUriLink');
71
- expect(link.prop('value')).toBe('entities/2eIQy30G');
72
- expect(link.text()).toBe('HCP DT 2');
73
- });
74
- it('should render correctly for more than three matches', function () {
75
- var newItem = __assign(__assign({}, item), { data: {
76
- potentialMatches: 'entities/1,entities/2,entities/3,entities/4',
77
- type: 'POTENTIAL_MATCHES_FOUND',
78
- 'entities/1': 'label1',
79
- 'entities/2': 'label2',
80
- 'entities/3': 'label3',
81
- 'entities/4': 'label4'
82
- } });
83
- useCollapsibleItems.mockImplementation(function () { return ({
84
- itemsToShow: newItem.data.potentialMatches.split(',').slice(0, 3),
85
- onExpand: onExpand,
86
- collapsedItemsCount: 1
87
- }); });
88
- var wrapper = shallow(React.createElement(PotentialMatchField, { item: newItem }));
89
- var links = wrapper.find('EntityUriLink');
90
- expect(links.length).toBe(3);
91
- links.forEach(function (item, i) {
92
- expect(item.prop('value')).toBe("entities/".concat(i + 1));
93
- expect(item.text()).toBe(newItem.data["entities/".concat(i + 1)]);
94
- });
95
- expect(wrapper.find('.andLabel')).toHaveLength(1);
96
- var moreIconLink = wrapper.find(MoreItemsLink);
97
- expect(moreIconLink.prop('itemsCount')).toEqual(1);
98
- expect(moreIconLink.prop('itemsLabel')).toEqual(i18n.text('match'));
99
- });
100
- it('should render all matches if recordId is included in expandedRecords from useCollapsibleItems', function () {
101
- var newItem = __assign(__assign({}, item), { data: {
102
- potentialMatches: 'entities/1,entities/2,entities/3,entities/4,entities/5',
103
- type: 'POTENTIAL_MATCHES_FOUND',
104
- 'entities/1': 'label1',
105
- 'entities/2': 'label2',
106
- 'entities/3': 'label3',
107
- 'entities/4': 'label4',
108
- 'entities/5': 'label5'
109
- } });
110
- useCollapsibleItems.mockImplementation(function () { return ({
111
- itemsToShow: newItem.data.potentialMatches.split(','),
112
- onExpand: onExpand,
113
- collapsedItemsCount: 0
114
- }); });
115
- var expandedLabel = 'Matches found:label1, label2, label3, label4, label5';
116
- var wrapper = mount(React.createElement(PotentialMatchField, { item: newItem }));
117
- expect(wrapper.text()).toContain(expandedLabel);
118
- expect(wrapper.find('.andLabel')).toHaveLength(0);
119
- });
120
- it('should call addExpandedRecord from useCollapsibleItems after clicking on expand', function () {
121
- var newItem = __assign(__assign({}, item), { data: {
122
- potentialMatches: 'entities/1,entities/2,entities/3,entities/4,entities/5',
123
- type: 'POTENTIAL_MATCHES_FOUND',
124
- 'entities/1': 'label1',
125
- 'entities/2': 'label2',
126
- 'entities/3': 'label3',
127
- 'entities/4': 'label4',
128
- 'entities/5': 'label5'
129
- } });
130
- useCollapsibleItems.mockImplementation(function () { return ({
131
- itemsToShow: newItem.data.potentialMatches.split(',').slice(0, 3),
132
- onExpand: onExpand,
133
- collapsedItemsCount: 2
134
- }); });
135
- var wrapper = shallow(React.createElement(PotentialMatchField, { item: newItem }));
136
- var links = wrapper.find('EntityUriLink');
137
- expect(links.length).toBe(3);
138
- links.forEach(function (item, i) {
139
- expect(item.prop('value')).toBe("entities/".concat(i + 1));
140
- expect(item.text()).toBe(newItem.data["entities/".concat(i + 1)]);
141
- });
142
- expect(wrapper.find('.andLabel')).toHaveLength(1);
143
- var moreIconLink = wrapper.find(MoreItemsLink);
144
- expect(moreIconLink.prop('itemsCount')).toEqual(2);
145
- expect(moreIconLink.prop('itemsLabel')).toEqual(i18n.text('matches'));
146
- act(function () {
147
- moreIconLink.prop('onClick')();
148
- });
149
- expect(onExpand).toHaveBeenCalled();
150
- });
151
- });
@@ -1,122 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { act } from 'react-dom/test-utils';
4
- import { RecordUpdates } from './RecordUpdates';
5
- import * as collapsibleItemsContext from '../contexts/CollapsibleItemsContext';
6
- import { MoreItemsLink } from '../MoreItemsLink';
7
- describe('RecordUpdates tests', function () {
8
- var delta1 = {
9
- type: 'ATTRIBUTE_CHANGED',
10
- attributeType: 'configuration/entityTypes/HCP/attributes/TextField',
11
- newValue: {
12
- value: 'Str31',
13
- ov: true,
14
- id: '3UIcE257b',
15
- sources: ['Reltio']
16
- },
17
- oldValue: {
18
- value: 'Str1',
19
- ov: true,
20
- id: '3UIcE257b',
21
- sources: ['Reltio']
22
- }
23
- };
24
- var delta2 = {
25
- type: 'ATTRIBUTE_ADDED',
26
- attributeType: 'configuration/entityTypes/HCP/attributes/TestField',
27
- newValue: {
28
- value: 'Test',
29
- ov: true,
30
- id: '3UIcE257b',
31
- sources: ['Reltio']
32
- }
33
- };
34
- var delta3 = {
35
- type: 'ATTRIBUTE_REMOVED',
36
- attributeType: 'configuration/entityTypes/HCP/attributes/TestField2',
37
- oldValue: {
38
- value: 'Test2',
39
- ov: true,
40
- id: '3UIcE257b',
41
- sources: ['Reltio']
42
- }
43
- };
44
- var delta4 = {
45
- type: 'ATTRIBUTE_CHANGED',
46
- attributeType: 'configuration/entityTypes/HCP/attributes/TestField4',
47
- newValue: {
48
- value: 'Test',
49
- ov: true,
50
- id: '3UIcE257b',
51
- sources: ['Reltio']
52
- },
53
- oldValue: {
54
- value: 'Test1',
55
- ov: true,
56
- id: '3UIcE257b',
57
- sources: ['Reltio']
58
- }
59
- };
60
- var delta5 = {
61
- type: 'ATTRIBUTE_CHANGED',
62
- attributeType: 'configuration/entityTypes/HCP/attributes/TestField5',
63
- newValue: {
64
- value: 'Test',
65
- ov: true,
66
- id: '3UIcE257b',
67
- sources: ['Reltio']
68
- },
69
- oldValue: {
70
- value: 'Test1',
71
- ov: true,
72
- id: '3UIcE257b',
73
- sources: ['Reltio']
74
- }
75
- };
76
- var onExpand = jest.fn();
77
- var useCollapsibleItems = jest.spyOn(collapsibleItemsContext, 'useCollapsibleItems');
78
- beforeEach(function () {
79
- useCollapsibleItems.mockImplementation(function () { return ({ itemsToShow: [], onExpand: onExpand, collapsedItemsCount: 0 }); });
80
- });
81
- it('should render empty state correctly', function () {
82
- var emptyDelta = undefined;
83
- var wrapper = shallow(React.createElement(RecordUpdates, { updates: emptyDelta, recordId: "id" }));
84
- expect(wrapper.find('DeltaField').length).toBe(0);
85
- });
86
- it('should render initial state correctly', function () {
87
- var delta = [delta1, delta2, delta3];
88
- useCollapsibleItems.mockImplementation(function () { return ({ itemsToShow: delta, onExpand: onExpand, collapsedItemsCount: 0 }); });
89
- var wrapper = shallow(React.createElement(RecordUpdates, { updates: delta, recordId: "id" }));
90
- expect(wrapper.find('DeltaField').length).toBe(3);
91
- });
92
- it('should render more than three records correctly', function () {
93
- var delta = [delta1, delta2, delta3, delta4];
94
- useCollapsibleItems.mockImplementation(function () { return ({
95
- itemsToShow: delta.slice(0, 3),
96
- onExpand: onExpand,
97
- collapsedItemsCount: 1
98
- }); });
99
- var wrapper = shallow(React.createElement(RecordUpdates, { updates: delta, recordId: "id" }));
100
- expect(wrapper.find('DeltaField').length).toBe(3);
101
- var moreItemsLink = wrapper.find(MoreItemsLink);
102
- expect(moreItemsLink.prop('itemsCount')).toBe(1);
103
- expect(moreItemsLink.prop('itemsLabel')).toBe('update');
104
- });
105
- it('should call addExpandedRecord from useExpandedRecords after clicking on expand button', function () {
106
- var delta = [delta1, delta2, delta3, delta4, delta5];
107
- useCollapsibleItems.mockImplementation(function () { return ({
108
- itemsToShow: delta.slice(0, 3),
109
- onExpand: onExpand,
110
- collapsedItemsCount: 2
111
- }); });
112
- var wrapper = shallow(React.createElement(RecordUpdates, { updates: delta, recordId: "id" }));
113
- expect(wrapper.find('DeltaField').length).toBe(3);
114
- var moreItemsLink = wrapper.find(MoreItemsLink);
115
- expect(moreItemsLink.prop('itemsCount')).toBe(2);
116
- expect(moreItemsLink.prop('itemsLabel')).toBe('updates');
117
- act(function () {
118
- moreItemsLink.prop('onClick')();
119
- });
120
- expect(onExpand).toHaveBeenCalledWith();
121
- });
122
- });