@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,153 +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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
- import React from 'react';
22
- import { mount, shallow } from 'enzyme';
23
- import { isNil, prop, sortBy } from 'ramda';
24
- import Select from 'react-select';
25
- import Typography from '@mui/material/Typography';
26
- import { ActivityTypes } from '../../../types';
27
- import { MultiSelect } from '../../../../../MultiSelect';
28
- import { getSelectorActivityTypes } from '../../helpers';
29
- import { ActivitySelector } from './ActivitySelector';
30
- var options = [
31
- { value: 'COMMENT_ADDED', label: 'Comment added' },
32
- { value: 'COMMENT_DELETED', label: 'Comment deleted' },
33
- { value: 'COMMENT_UPDATED', label: 'Comment updated' },
34
- { value: 'ENTITIES_MERGED', label: 'Profile merged' },
35
- { value: 'ENTITIES_MERGED_MANUALLY', label: 'Profile merged manually' },
36
- { value: 'ENTITIES_MERGED_ON_THE_FLY', label: 'Profile merged on the fly' },
37
- { value: 'ENTITIES_SPLITTED', label: 'Profile un-merged' },
38
- { value: 'ENTITY_CHANGED', label: 'Profile updated' },
39
- { value: 'ENTITY_CREATED', label: 'Profile created' },
40
- { value: 'ENTITY_LOST_MERGE', label: 'Profile lost merge' },
41
- { value: 'ENTITY_REMOVED', label: 'Profile removed' },
42
- { value: 'MODEL_UPDATED', label: 'Model was updated' },
43
- { value: 'NOT_MATCHES_RESET', label: 'Not matches reset' },
44
- { value: 'NOT_MATCHES_SET', label: 'Not matches set' },
45
- { value: 'PERIODIC_TASK_SCHEDULED', label: 'Periodic task was scheduled' },
46
- { value: 'POTENTIAL_MATCHES_FOUND', label: 'Potential matches found' },
47
- { value: 'POTENTIAL_MATCHES_REMOVED', label: 'Potential matches removed' },
48
- { value: 'RELATIONSHIP_CHANGED', label: 'Relationship updated' },
49
- { value: 'RELATIONSHIP_CREATED', label: 'Relationship created' },
50
- { value: 'RELATIONSHIP_REMOVED', label: 'Relationship removed' },
51
- { value: 'USER_LOGIN', label: 'Logged in' },
52
- { value: 'USER_LOGOUT', label: 'Logged out' },
53
- { value: 'USER_PROFILE_VIEW', label: 'Profile viewed' },
54
- { value: 'USER_SEARCH', label: 'Searched' },
55
- { value: 'ANALYTICS_ATTRIBUTES_CHANGED', label: 'Analytics attribute changed' },
56
- { value: 'SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE', label: 'SFDC connector synchronization issue' }
57
- ];
58
- var profileOptions = [
59
- { value: 'ENTITIES_MERGED', label: 'Profile merged' },
60
- { value: 'ENTITIES_SPLITTED', label: 'Profile un-merged' },
61
- { value: 'ENTITY_CHANGED', label: 'Profile updated' },
62
- { value: 'ENTITY_CREATED', label: 'Profile created' },
63
- { value: 'NOT_MATCHES_RESET', label: 'Not matches reset' },
64
- { value: 'NOT_MATCHES_SET', label: 'Not matches set' },
65
- { value: 'POTENTIAL_MATCHES_FOUND', label: 'Potential matches found' },
66
- { value: 'POTENTIAL_MATCHES_REMOVED', label: 'Potential matches removed' },
67
- { value: 'RELATIONSHIP_CHANGED', label: 'Relationship updated' },
68
- { value: 'RELATIONSHIP_CREATED', label: 'Relationship created' },
69
- { value: 'RELATIONSHIP_REMOVED', label: 'Relationship removed' },
70
- { value: 'ENTITIES_MERGED_MANUALLY', label: 'Profile merged manually' },
71
- { value: 'ENTITIES_MERGED_ON_THE_FLY', label: 'Profile merged on the fly' },
72
- { value: 'ENTITY_LOST_MERGE', label: 'Profile lost merge' }
73
- ];
74
- var groupOptions = [
75
- { value: 'GROUP_CHANGED', label: 'Group updated' },
76
- { value: 'GROUP_CREATED', label: 'Group created' },
77
- { value: 'GROUP_REMOVED', label: 'Group removed' }
78
- ];
79
- var metadata = { entityTypes: [] };
80
- describe('ActivitySelector tests', function () {
81
- var props = {
82
- activityTypes: getSelectorActivityTypes(metadata),
83
- selectedActivityTypes: [ActivityTypes.MODEL_UPDATED, ActivityTypes.COMMENT_ADDED],
84
- onChange: jest.fn()
85
- };
86
- var sortOptionsByLabel = sortBy(prop('label'));
87
- it('should render correct default state', function () {
88
- var selectedOptions = [
89
- { value: 'MODEL_UPDATED', label: 'Model was updated' },
90
- { value: 'COMMENT_ADDED', label: 'Comment added' }
91
- ];
92
- var wrapper = mount(React.createElement(ActivitySelector, __assign({}, props)));
93
- expect(wrapper.find(Typography).filterWhere(function (component) { return component.text() === 'Activity'; }).length).toBe(1);
94
- expect(wrapper.find('.selectorHint')).toHaveLength(0);
95
- var select = wrapper.find(MultiSelect);
96
- expect(select.length).toBe(1);
97
- expect(sortOptionsByLabel(select.prop('options'))).toEqual(sortOptionsByLabel(options));
98
- var isSearchableProp = wrapper.find(Select).prop('isSearchable');
99
- expect(isNil(isSearchableProp) || isSearchableProp).toBe(true);
100
- expect(sortOptionsByLabel(select.prop('value'))).toEqual(sortOptionsByLabel(selectedOptions));
101
- });
102
- it('should render group options if metadata has not empty groupTypes', function () {
103
- var metadata = {
104
- entityTypes: [],
105
- groupTypes: [
106
- {
107
- uri: 'test',
108
- dataLabel: '',
109
- dataLabelPattern: '',
110
- dataTooltipPattern: '',
111
- description: '',
112
- groupElements: {
113
- entityTypeURIs: [],
114
- uri: ''
115
- },
116
- hasPrimaryMember: false,
117
- label: '',
118
- memberTypes: [],
119
- multiplePrimaryMembers: false,
120
- type: ''
121
- }
122
- ]
123
- };
124
- var fullOptions = sortOptionsByLabel(__spreadArray(__spreadArray([], options, true), groupOptions, true));
125
- var wrapper = shallow(React.createElement(ActivitySelector, __assign({}, props, { activityTypes: getSelectorActivityTypes(metadata) })));
126
- expect(sortOptionsByLabel(wrapper.find(MultiSelect).prop('options'))).toEqual(fullOptions);
127
- });
128
- it('should render profile options if entityType passed', function () {
129
- var metadata = {
130
- entityTypes: []
131
- };
132
- var activityTypes = getSelectorActivityTypes(metadata, { attributes: [], uri: '' });
133
- var fullOptions = sortOptionsByLabel(profileOptions);
134
- var wrapper = shallow(React.createElement(ActivitySelector, __assign({}, props, { activityTypes: activityTypes })));
135
- expect(sortOptionsByLabel(wrapper.find(MultiSelect).prop('options'))).toEqual(fullOptions);
136
- });
137
- it('should call onChange when new option is selected', function () {
138
- var newValues = [
139
- { value: 'COMMENT_UPDATED', label: 'Comment updated' },
140
- { value: 'NOT_MATCHES_RESET', label: 'Not matches reset' }
141
- ];
142
- var wrapper = shallow(React.createElement(ActivitySelector, __assign({}, props)));
143
- var select = wrapper.find(MultiSelect);
144
- select.prop('onChange')(newValues);
145
- expect(props.onChange).toHaveBeenCalledWith(['COMMENT_UPDATED', 'NOT_MATCHES_RESET']);
146
- });
147
- it('should show hint if activities length more then one and includes ENTITY_CHANGED', function () {
148
- var wrapper = shallow(React.createElement(ActivitySelector, __assign({}, props, { selectedActivityTypes: [ActivityTypes.ENTITY_CHANGED, ActivityTypes.NOT_MATCHES_RESET] })));
149
- var hint = wrapper.find('.selectorHint');
150
- expect(hint).toHaveLength(1);
151
- expect(hint.text()).toBe('One at a time! Select a single Activity and any of its filters -OR- multiple Activities with no filters.');
152
- });
153
- });
@@ -1,130 +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 { DateRangeTypes, findClosestCommonAncestor } from '@reltio/mdm-sdk';
15
- import { AttributeSelector } from '../../../../../AttributeSelector';
16
- import { SourceSelector } from '../SourceSelector';
17
- import { EntityChangedSelectors } from './EntityChangedSelectors';
18
- import { EntityTypesSelector } from '../EntityTypesSelector';
19
- import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
20
- jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { findClosestCommonAncestor: jest.fn() })); });
21
- jest.mock('../../../../../AttributeSelector', function () { return ({
22
- AttributeSelector: function () { return null; }
23
- }); });
24
- jest.mock('../SourceSelector', function () { return ({
25
- SourceSelector: function () { return null; }
26
- }); });
27
- jest.mock('../EntityTypesSelector', function () { return ({
28
- EntityTypesSelector: function () { return null; }
29
- }); });
30
- var defaultMetadata = {
31
- entityTypes: [
32
- {
33
- uri: 'configuration/entityTypes/HCP',
34
- label: 'HCP',
35
- attributes: []
36
- },
37
- {
38
- uri: 'configuration/entityTypes/HCA',
39
- label: 'HCA',
40
- attributes: []
41
- },
42
- {
43
- uri: 'configuration/entityTypes/EntityType',
44
- label: 'EntityType',
45
- attributes: []
46
- }
47
- ]
48
- };
49
- var filter = {
50
- activities: [],
51
- users: [],
52
- dateRange: {
53
- type: DateRangeTypes.WITHIN,
54
- period: [4, 'month']
55
- },
56
- attributes: [
57
- {
58
- label: 'Activity',
59
- value: 'configuration/entityTypes/HCP/attributes/activitywith',
60
- attrType: {
61
- label: 'Activity',
62
- name: 'activitywith',
63
- description: 'Activity',
64
- type: 'Reference',
65
- uri: 'configuration/entityTypes/HCP/attributes/activitywith'
66
- },
67
- chipLabel: 'Activity',
68
- level: 0
69
- }
70
- ],
71
- sources: [
72
- {
73
- uri: 'configuration/sources/Reltio',
74
- label: 'Reltio',
75
- icon: 'images/source/reltio.png',
76
- abbreviation: 'Reltio'
77
- }
78
- ],
79
- entityTypes: [
80
- {
81
- uri: 'configuration/entityTypes/HCA',
82
- label: 'HCA',
83
- attributes: []
84
- },
85
- {
86
- uri: 'configuration/entityTypes/HCP',
87
- label: 'HCP',
88
- attributes: []
89
- }
90
- ]
91
- };
92
- var defaultProps = { filter: filter, onPropChange: jest.fn() };
93
- var setUp = function (props) {
94
- if (props === void 0) { props = defaultProps; }
95
- return mount(React.createElement(MdmModuleProvider, { values: { metadata: defaultMetadata } },
96
- React.createElement(EntityChangedSelectors, __assign({}, props))));
97
- };
98
- describe('EntityChangedSelectors tests', function () {
99
- beforeAll(function () {
100
- findClosestCommonAncestor.mockReturnValue(defaultMetadata.entityTypes[0].uri);
101
- });
102
- it('should render correct default state', function () {
103
- var wrapper = setUp();
104
- var entityTypeSelector = wrapper.find(EntityTypesSelector);
105
- expect(entityTypeSelector.length).toBe(1);
106
- expect(entityTypeSelector.props()).toMatchObject({});
107
- var attributeSelector = wrapper.find(AttributeSelector);
108
- expect(attributeSelector.length).toBe(1);
109
- expect(attributeSelector.props()).toMatchObject({
110
- selectedAttributes: defaultProps.filter.attributes,
111
- entityType: defaultMetadata.entityTypes[0],
112
- disableUnderline: true
113
- });
114
- expect(wrapper.find(SourceSelector).length).toBe(1);
115
- expect(wrapper.find(SourceSelector).prop('selectedSources')).toBe(defaultProps.filter.sources);
116
- });
117
- it('should not render EntityTypesSelector and pass entityType when entityType prop is defined', function () {
118
- var entityType = { uri: 'test', attributes: [] };
119
- var wrapper = setUp(__assign(__assign({}, defaultProps), { entityType: entityType }));
120
- expect(wrapper.find(EntityTypesSelector).length).toBe(0);
121
- expect(wrapper.find(AttributeSelector).length).toBe(1);
122
- expect(wrapper.find(AttributeSelector).props()).toMatchObject({
123
- selectedAttributes: defaultProps.filter.attributes,
124
- entityType: entityType,
125
- disableUnderline: true
126
- });
127
- expect(wrapper.find(SourceSelector).length).toBe(1);
128
- expect(wrapper.find(SourceSelector).prop('selectedSources')).toBe(defaultProps.filter.sources);
129
- });
130
- });
@@ -1,60 +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 { shallow } from 'enzyme';
14
- import { prop, sortBy, pipe, map } from 'ramda';
15
- import { MultiSelect } from '../../../../../MultiSelect';
16
- import { EntityTypesSelector } from './EntityTypesSelector';
17
- var entityTypes = [
18
- {
19
- uri: 'configuration/entityTypes/HCP',
20
- label: 'HCP',
21
- attributes: []
22
- },
23
- {
24
- uri: 'configuration/entityTypes/HCA',
25
- label: 'HCA',
26
- attributes: []
27
- },
28
- {
29
- uri: 'configuration/entityTypes/EntityType',
30
- label: 'EntityType',
31
- attributes: []
32
- }
33
- ];
34
- var selectedEntityTypes = [entityTypes[0], entityTypes[1]];
35
- var prepareOption = map(function (entityType) { return ({ label: entityType.label, value: entityType.uri, entityType: entityType }); });
36
- describe('EntityTypesSelector tests', function () {
37
- var onChangeSpy = jest.fn();
38
- var props = {
39
- entityTypes: entityTypes,
40
- selectedEntityTypes: selectedEntityTypes,
41
- onChange: onChangeSpy
42
- };
43
- it('should render correctly', function () {
44
- var wrapper = shallow(React.createElement(EntityTypesSelector, __assign({}, props)));
45
- expect(wrapper.find('.filterSubtitle').text()).toBe('Type');
46
- var select = wrapper.find(MultiSelect);
47
- expect(select.length).toBe(1);
48
- expect(select.props()).toMatchObject({
49
- options: pipe(sortBy(prop('label')), prepareOption)(entityTypes),
50
- value: prepareOption(selectedEntityTypes)
51
- });
52
- });
53
- it('should call onChange when new option is selected', function () {
54
- var newValues = [{ value: entityTypes[2].uri, label: entityTypes[2].label, entityType: entityTypes[2] }];
55
- var wrapper = shallow(React.createElement(EntityTypesSelector, __assign({}, props)));
56
- var select = wrapper.find(MultiSelect);
57
- select.prop('onChange')(newValues);
58
- expect(onChangeSpy).toHaveBeenCalledWith(newValues.map(function (value) { return value.entityType; }));
59
- });
60
- });
@@ -1,114 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import React from 'react';
49
- import { render, screen } from '@testing-library/react';
50
- import userEvent from '@testing-library/user-event';
51
- import { SourceSelector } from './SourceSelector';
52
- import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
53
- var defaultMetadata = {
54
- sources: [
55
- {
56
- uri: 'configuration/sources/IMSPLAN',
57
- label: 'IMS PLAN',
58
- icon: 'images/source/source_s.png',
59
- abbreviation: 'IMSPLAN'
60
- },
61
- {
62
- uri: 'configuration/sources/RELTIO',
63
- label: 'RELTIO',
64
- icon: 'images/source/source_s.png',
65
- abbreviation: 'RELTIO'
66
- },
67
- {
68
- uri: 'configuration/sources/TEST',
69
- label: 'TEST',
70
- icon: 'images/source/source_s.png',
71
- abbreviation: 'TEST'
72
- }
73
- ],
74
- entityTypes: []
75
- };
76
- var defaultProps = {
77
- selectedSources: [],
78
- onChange: jest.fn()
79
- };
80
- var setUp = function (props) {
81
- if (props === void 0) { props = defaultProps; }
82
- var user = userEvent.setup();
83
- var Providers = function (_a) {
84
- var children = _a.children;
85
- return (React.createElement(MdmModuleProvider, { values: { metadata: defaultMetadata } }, children));
86
- };
87
- return __assign(__assign({}, render(React.createElement(SourceSelector, __assign({}, props)), { wrapper: Providers })), { user: user });
88
- };
89
- describe('Source selector tests', function () {
90
- it('should render correct default state and call onChange when new item is selected', function () { return __awaiter(void 0, void 0, void 0, function () {
91
- var onChange, user, input, _a, sources;
92
- return __generator(this, function (_b) {
93
- switch (_b.label) {
94
- case 0:
95
- onChange = defaultProps.onChange;
96
- user = setUp().user;
97
- screen.getByText('Source');
98
- input = screen.getByRole('combobox');
99
- return [4 /*yield*/, user.click(input)];
100
- case 1:
101
- _b.sent();
102
- screen.getByText('IMS PLAN');
103
- screen.getByText('RELTIO');
104
- screen.getByText('TEST');
105
- return [4 /*yield*/, user.click(screen.getByText('IMS PLAN'))];
106
- case 2:
107
- _b.sent();
108
- _a = defaultMetadata.sources, sources = _a === void 0 ? [] : _a;
109
- expect(onChange).toHaveBeenCalledWith([sources[0]], expect.any(Object));
110
- return [2 /*return*/];
111
- }
112
- });
113
- }); });
114
- });
@@ -1,25 +0,0 @@
1
- import { ActivitiesFilter } from '../types';
2
- export declare const usersResponse: {
3
- username: string;
4
- email: string;
5
- }[];
6
- export declare const value: ActivitiesFilter;
7
- export declare const metadata: {
8
- entityTypes: {
9
- uri: string;
10
- label: string;
11
- attributes: {
12
- label: string;
13
- name: string;
14
- description: string;
15
- type: string;
16
- hidden: boolean;
17
- important: boolean;
18
- system: boolean;
19
- searchable: boolean;
20
- uri: string;
21
- }[];
22
- }[];
23
- relationTypes: any[];
24
- sources: any[];
25
- };
@@ -1,72 +0,0 @@
1
- import { DateRangeTypes } from '@reltio/mdm-sdk';
2
- import { ActivityTypes } from '../types';
3
- export var usersResponse = [
4
- { username: 'username1', email: 'email1' },
5
- { username: 'username2', email: 'email2' },
6
- { username: 'username3', email: 'email3' }
7
- ];
8
- var entityTypes = [
9
- {
10
- uri: 'configuration/entityTypes/HCA',
11
- label: 'HCA',
12
- attributes: []
13
- },
14
- {
15
- uri: 'configuration/entityTypes/HCP',
16
- label: 'HCP',
17
- attributes: [
18
- {
19
- label: 'Activity',
20
- name: 'activitywith',
21
- description: 'Activity',
22
- type: 'String',
23
- hidden: false,
24
- important: false,
25
- system: false,
26
- searchable: true,
27
- uri: 'configuration/entityTypes/HCP/attributes/activitywith'
28
- }
29
- ]
30
- }
31
- ];
32
- export var value = {
33
- users: ['username1', 'username2'],
34
- activities: [ActivityTypes.MODEL_UPDATED, ActivityTypes.COMMENT_ADDED],
35
- attributes: [
36
- {
37
- label: 'Activity',
38
- value: 'configuration/entityTypes/HCP/attributes/activitywith',
39
- attrType: {
40
- label: 'Activity',
41
- name: 'activitywith',
42
- description: 'Activity',
43
- type: 'String',
44
- hidden: false,
45
- important: false,
46
- system: false,
47
- searchable: true,
48
- uri: 'configuration/entityTypes/HCP/attributes/activitywith'
49
- },
50
- chipLabel: 'Activity',
51
- level: 0
52
- }
53
- ],
54
- sources: [
55
- {
56
- uri: 'configuration/sources/Reltio',
57
- label: 'Reltio',
58
- icon: 'images/source/reltio.png',
59
- abbreviation: 'Reltio'
60
- }
61
- ],
62
- entityTypes: entityTypes,
63
- dateRange: {
64
- type: DateRangeTypes.WITHIN,
65
- period: [4, 'month']
66
- }
67
- };
68
- export var metadata = {
69
- entityTypes: entityTypes,
70
- relationTypes: [],
71
- sources: []
72
- };