@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.
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +267 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
- package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
- package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
- package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
- package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
- package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
- package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
- package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
- package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
- package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
- package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
- package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
- package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
- package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
- package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
- package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
- package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +784 -0
- package/cjs/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
- package/cjs/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
- package/cjs/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +102 -79
- package/cjs/features/activity-log/EntityObject/EntityObject.test.js +35 -26
- package/cjs/features/activity-log/Field/Field.d.ts +2 -3
- package/cjs/features/activity-log/Field/Field.js +24 -2
- package/cjs/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
- package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
- package/cjs/features/activity-log/RecordUpdates/RecordUpdates.test.js +207 -0
- package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
- package/cjs/features/activity-log/RelationObject/RelationObject.test.js +46 -29
- package/cjs/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
- package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
- package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
- package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +262 -0
- package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
- package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
- package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
- package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
- package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
- package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
- package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
- package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
- package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
- package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
- package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
- package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
- package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
- package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
- package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
- package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
- package/esm/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
- package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
- package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +779 -0
- package/esm/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
- package/esm/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
- package/esm/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +104 -58
- package/esm/features/activity-log/EntityObject/EntityObject.test.js +35 -26
- package/esm/features/activity-log/Field/Field.d.ts +2 -3
- package/esm/features/activity-log/Field/Field.js +24 -2
- package/esm/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
- package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
- package/esm/features/activity-log/RecordUpdates/RecordUpdates.test.js +202 -0
- package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
- package/esm/features/activity-log/RelationObject/RelationObject.test.js +46 -29
- package/esm/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
- package/package.json +1 -1
- package/cjs/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -142
- package/cjs/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -131
- package/cjs/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -252
- package/cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -158
- package/cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -135
- package/cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -65
- package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
- package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -119
- package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
- package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -75
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -140
- package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
- package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -41
- package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
- package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -87
- package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
- package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -19
- package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
- package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -179
- package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
- package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -150
- package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
- package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -124
- package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -137
- package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -126
- package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -247
- package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -153
- package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -130
- package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -60
- package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -114
- package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
- package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -72
- package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
- package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -135
- package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
- package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -36
- package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
- package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -82
- package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
- package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -14
- package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
- package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -151
- package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
- package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -122
- package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
- package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -119
- /package/cjs/features/activity-log/{ActivityExportButton/ActivityExportButton.specs.d.ts → ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
- /package/cjs/features/activity-log/{ActivityFilterButton/ActivityFilterButton.specs.d.ts → ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
- /package/cjs/features/activity-log/{ActivityFilterEditor/ActivityFilterEditor.specs.d.ts → RecordUpdates/RecordUpdates.test.d.ts} +0 -0
- /package/{cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts → esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
- /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts → esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
- /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts → esm/features/activity-log/RecordUpdates/RecordUpdates.test.d.ts} +0 -0
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var test_utils_1 = require("react-dom/test-utils");
|
|
20
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
21
|
-
var types_1 = require("../types");
|
|
22
|
-
var SmallIconButton_1 = require("../../../SmallIconButton");
|
|
23
|
-
var ActivityFilterEditor_1 = require("../ActivityFilterEditor");
|
|
24
|
-
var ActivityFilterButton_1 = require("./ActivityFilterButton");
|
|
25
|
-
describe('ActivityFilterButton tests', function () {
|
|
26
|
-
var filter = {
|
|
27
|
-
users: [],
|
|
28
|
-
activities: [],
|
|
29
|
-
dateRange: {
|
|
30
|
-
type: mdm_sdk_1.DateRangeTypes.WITHIN,
|
|
31
|
-
period: [4, 'month']
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var props = {
|
|
35
|
-
filter: filter,
|
|
36
|
-
entityType: {
|
|
37
|
-
uri: 'configuration/entityTypes/Contact',
|
|
38
|
-
label: 'Contact',
|
|
39
|
-
attributes: []
|
|
40
|
-
},
|
|
41
|
-
onChange: jest.fn()
|
|
42
|
-
};
|
|
43
|
-
it('should render correctly', function () {
|
|
44
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
45
|
-
var button = wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip);
|
|
46
|
-
expect(button).toHaveLength(1);
|
|
47
|
-
expect(button.hasClass('activeIcon')).toBe(false);
|
|
48
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).props()).toMatchObject({
|
|
49
|
-
open: false,
|
|
50
|
-
value: props.filter,
|
|
51
|
-
entityType: props.entityType
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('should have active filter icon if filter changed', function () {
|
|
55
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
56
|
-
expect(wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).hasClass('activeIcon')).toBe(false);
|
|
57
|
-
wrapper.setProps({ filter: __assign(__assign({}, filter), { users: ['123'] }) });
|
|
58
|
-
expect(wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).hasClass('activeIcon')).toBe(true);
|
|
59
|
-
});
|
|
60
|
-
it('should open editor on button click', function () {
|
|
61
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
62
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(false);
|
|
63
|
-
(0, test_utils_1.act)(function () {
|
|
64
|
-
wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).simulate('click');
|
|
65
|
-
});
|
|
66
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(true);
|
|
67
|
-
});
|
|
68
|
-
it('should call props.onChange and close editor when ActivityFilterEditor onApply is invoke', function () {
|
|
69
|
-
var newFilterValue = {
|
|
70
|
-
users: ['ivanov'],
|
|
71
|
-
activities: [types_1.ActivityTypes.MODEL_UPDATED],
|
|
72
|
-
dateRange: {
|
|
73
|
-
type: mdm_sdk_1.DateRangeTypes.AGO,
|
|
74
|
-
period: [1, 'day']
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
78
|
-
(0, test_utils_1.act)(function () {
|
|
79
|
-
wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).simulate('click');
|
|
80
|
-
});
|
|
81
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(true);
|
|
82
|
-
(0, test_utils_1.act)(function () {
|
|
83
|
-
wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('onApply')(newFilterValue);
|
|
84
|
-
});
|
|
85
|
-
expect(props.onChange).toHaveBeenCalledWith(newFilterValue);
|
|
86
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
it('should call props.onChange with correct filter if dateRange is not valid', function () {
|
|
89
|
-
var newFilterValue = {
|
|
90
|
-
users: ['ivanov'],
|
|
91
|
-
activities: [types_1.ActivityTypes.MODEL_UPDATED],
|
|
92
|
-
dateRange: {
|
|
93
|
-
type: mdm_sdk_1.DateRangeTypes.AGO,
|
|
94
|
-
period: [null, 'day']
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
98
|
-
(0, test_utils_1.act)(function () {
|
|
99
|
-
wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).simulate('click');
|
|
100
|
-
});
|
|
101
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(true);
|
|
102
|
-
(0, test_utils_1.act)(function () {
|
|
103
|
-
wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('onApply')(newFilterValue);
|
|
104
|
-
});
|
|
105
|
-
expect(props.onChange).toHaveBeenCalledWith({
|
|
106
|
-
users: ['ivanov'],
|
|
107
|
-
activities: [types_1.ActivityTypes.MODEL_UPDATED],
|
|
108
|
-
dateRange: props.filter.dateRange
|
|
109
|
-
});
|
|
110
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(false);
|
|
111
|
-
});
|
|
112
|
-
it('should close editor when ActivityFilterEditor onCancel is invoke', function () {
|
|
113
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
114
|
-
(0, test_utils_1.act)(function () {
|
|
115
|
-
wrapper.find(SmallIconButton_1.SmallIconButtonWithTooltip).simulate('click');
|
|
116
|
-
});
|
|
117
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(true);
|
|
118
|
-
(0, test_utils_1.act)(function () {
|
|
119
|
-
wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('onCancel')();
|
|
120
|
-
});
|
|
121
|
-
expect(wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('open')).toBe(false);
|
|
122
|
-
});
|
|
123
|
-
it('should clear filter when ActivityFilterEditor onClear is invoke', function () {
|
|
124
|
-
var initialFilter = props.filter;
|
|
125
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivityFilterButton_1.ActivityFilterButton, __assign({}, props)));
|
|
126
|
-
(0, test_utils_1.act)(function () {
|
|
127
|
-
wrapper.find(ActivityFilterEditor_1.ActivityFilterEditor).prop('onClear')();
|
|
128
|
-
});
|
|
129
|
-
expect(props.onChange).toHaveBeenCalledWith(__assign({}, initialFilter));
|
|
130
|
-
});
|
|
131
|
-
});
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
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);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
var react_1 = __importDefault(require("react"));
|
|
54
|
-
var react_2 = require("@testing-library/react");
|
|
55
|
-
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
57
|
-
var ActivityFilterEditor_1 = require("./ActivityFilterEditor");
|
|
58
|
-
var editor_test_data_1 = require("./editor.test-data");
|
|
59
|
-
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
60
|
-
var types_1 = require("../types");
|
|
61
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getAllUsersForTenant: jest.fn() })); });
|
|
62
|
-
describe('ActivityFilterEditor tests', function () {
|
|
63
|
-
var defaultProps = {
|
|
64
|
-
value: editor_test_data_1.value,
|
|
65
|
-
open: true,
|
|
66
|
-
anchorEl: document.createElement('div'),
|
|
67
|
-
onApply: jest.fn(),
|
|
68
|
-
onCancel: jest.fn(),
|
|
69
|
-
onClear: jest.fn()
|
|
70
|
-
};
|
|
71
|
-
var setUp = function (props) {
|
|
72
|
-
if (props === void 0) { props = {}; }
|
|
73
|
-
var user = user_event_1.default.setup();
|
|
74
|
-
var Providers = function (_a) {
|
|
75
|
-
var children = _a.children;
|
|
76
|
-
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { metadata: editor_test_data_1.metadata } }, children));
|
|
77
|
-
};
|
|
78
|
-
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(ActivityFilterEditor_1.ActivityFilterEditor, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
79
|
-
};
|
|
80
|
-
beforeAll(function () {
|
|
81
|
-
mdm_sdk_1.getAllUsersForTenant.mockResolvedValue(editor_test_data_1.usersResponse);
|
|
82
|
-
});
|
|
83
|
-
beforeEach(function () {
|
|
84
|
-
jest.clearAllMocks();
|
|
85
|
-
});
|
|
86
|
-
it('should render correct default state', function () {
|
|
87
|
-
setUp();
|
|
88
|
-
var activitySelector = react_2.screen.getByTestId('activity-selector');
|
|
89
|
-
expect((0, react_2.within)(activitySelector).getByText('Activity')).toBeInTheDocument();
|
|
90
|
-
expect((0, react_2.within)(activitySelector).getByText('Model was updated')).toBeInTheDocument();
|
|
91
|
-
expect((0, react_2.within)(activitySelector).getByText('Comment added')).toBeInTheDocument();
|
|
92
|
-
var dateRangeSelector = react_2.screen.getByTestId('date-range-selector');
|
|
93
|
-
expect((0, react_2.within)(dateRangeSelector).getByText('Date')).toBeInTheDocument();
|
|
94
|
-
expect((0, react_2.within)(dateRangeSelector).getByText('Within the last')).toBeInTheDocument();
|
|
95
|
-
expect((0, react_2.within)(dateRangeSelector).getAllByRole('spinbutton')[0]).toHaveValue(4);
|
|
96
|
-
var userSelector = react_2.screen.getByTestId('user-selector');
|
|
97
|
-
expect((0, react_2.within)(userSelector).getByText('User')).toBeInTheDocument();
|
|
98
|
-
expect((0, react_2.within)(userSelector).getByText('username1')).toBeInTheDocument();
|
|
99
|
-
expect((0, react_2.within)(userSelector).getByText('username2')).toBeInTheDocument();
|
|
100
|
-
expect(react_2.screen.queryByTestId('entity-types-selector')).not.toBeInTheDocument();
|
|
101
|
-
expect(react_2.screen.queryByTestId('attribute-selector')).not.toBeInTheDocument();
|
|
102
|
-
expect(react_2.screen.queryByTestId('source-selector')).not.toBeInTheDocument();
|
|
103
|
-
expect(react_2.screen.getByText('Clear all')).toBeInTheDocument();
|
|
104
|
-
expect(react_2.screen.getByText('Cancel')).toBeInTheDocument();
|
|
105
|
-
expect(react_2.screen.getByText('Apply')).toBeInTheDocument();
|
|
106
|
-
});
|
|
107
|
-
it('should render correct default state for ENTITY_CHANGED', function () {
|
|
108
|
-
var filterValue = __assign(__assign({}, editor_test_data_1.value), { activities: [types_1.ActivityTypes.ENTITY_CHANGED] });
|
|
109
|
-
var entityType = { uri: 'test', attributes: [] };
|
|
110
|
-
setUp({ value: filterValue, entityType: entityType });
|
|
111
|
-
expect(react_2.screen.getByTestId('activity-selector')).toBeInTheDocument();
|
|
112
|
-
expect(react_2.screen.queryByTestId('entity-types-selector')).not.toBeInTheDocument();
|
|
113
|
-
expect(react_2.screen.getByTestId('date-range-selector')).toBeInTheDocument();
|
|
114
|
-
expect(react_2.screen.getByTestId('user-selector')).toBeInTheDocument();
|
|
115
|
-
var attributeSelector = react_2.screen.getByTestId('attribute-selector');
|
|
116
|
-
expect((0, react_2.within)(attributeSelector).getByText('Attribute')).toBeInTheDocument();
|
|
117
|
-
expect((0, react_2.within)(attributeSelector).getByText('Activity')).toBeInTheDocument();
|
|
118
|
-
var sourceSelector = react_2.screen.getByTestId('source-selector');
|
|
119
|
-
expect((0, react_2.within)(sourceSelector).getByText('Source')).toBeInTheDocument();
|
|
120
|
-
expect((0, react_2.within)(sourceSelector).getByText('Reltio')).toBeInTheDocument();
|
|
121
|
-
});
|
|
122
|
-
it('should hide filter when props.open = false', function () {
|
|
123
|
-
var container = setUp({ open: false }).container;
|
|
124
|
-
expect(container).toBeEmptyDOMElement();
|
|
125
|
-
});
|
|
126
|
-
it('should clear current value and call props.onClear on Clear all button click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
127
|
-
var user, userSelector, activitySelector;
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
switch (_a.label) {
|
|
130
|
-
case 0:
|
|
131
|
-
user = setUp().user;
|
|
132
|
-
userSelector = react_2.screen.getByTestId('user-selector');
|
|
133
|
-
expect((0, react_2.within)(userSelector).getByText('username1')).toBeInTheDocument();
|
|
134
|
-
activitySelector = react_2.screen.getByTestId('activity-selector');
|
|
135
|
-
expect((0, react_2.within)(activitySelector).getByText('Model was updated')).toBeInTheDocument();
|
|
136
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Clear all'))];
|
|
137
|
-
case 1:
|
|
138
|
-
_a.sent();
|
|
139
|
-
expect((0, react_2.within)(userSelector).queryByText('username1')).not.toBeInTheDocument();
|
|
140
|
-
expect((0, react_2.within)(userSelector).queryByText('username2')).not.toBeInTheDocument();
|
|
141
|
-
expect((0, react_2.within)(activitySelector).queryByText('Model was updated')).not.toBeInTheDocument();
|
|
142
|
-
expect((0, react_2.within)(activitySelector).queryByText('Comment added')).not.toBeInTheDocument();
|
|
143
|
-
expect(defaultProps.onClear).toHaveBeenCalled();
|
|
144
|
-
return [2 /*return*/];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}); });
|
|
148
|
-
it('should call onCancel when click on Cancel button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
-
var user;
|
|
150
|
-
return __generator(this, function (_a) {
|
|
151
|
-
switch (_a.label) {
|
|
152
|
-
case 0:
|
|
153
|
-
user = setUp().user;
|
|
154
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Cancel'))];
|
|
155
|
-
case 1:
|
|
156
|
-
_a.sent();
|
|
157
|
-
expect(defaultProps.onCancel).toHaveBeenCalled();
|
|
158
|
-
return [2 /*return*/];
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}); });
|
|
162
|
-
it('should call onApply when click on Apply button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
|
-
var user;
|
|
164
|
-
return __generator(this, function (_a) {
|
|
165
|
-
switch (_a.label) {
|
|
166
|
-
case 0:
|
|
167
|
-
user = setUp().user;
|
|
168
|
-
return [4 /*yield*/, user.type(react_2.screen.getAllByRole('spinbutton')[0], '5')];
|
|
169
|
-
case 1:
|
|
170
|
-
_a.sent();
|
|
171
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Apply'))];
|
|
172
|
-
case 2:
|
|
173
|
-
_a.sent();
|
|
174
|
-
expect(defaultProps.onApply).toHaveBeenCalledWith(__assign(__assign({}, defaultProps.value), { dateRange: {
|
|
175
|
-
type: mdm_sdk_1.DateRangeTypes.WITHIN,
|
|
176
|
-
period: [45, 'month']
|
|
177
|
-
} }));
|
|
178
|
-
return [2 /*return*/];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}); });
|
|
182
|
-
it('should correctly change filter onPropChange calls', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
183
|
-
var filterValue, entityType, user, attributeSelector;
|
|
184
|
-
return __generator(this, function (_a) {
|
|
185
|
-
switch (_a.label) {
|
|
186
|
-
case 0:
|
|
187
|
-
filterValue = __assign(__assign({}, editor_test_data_1.value), { activities: [types_1.ActivityTypes.ENTITY_CHANGED] });
|
|
188
|
-
entityType = editor_test_data_1.metadata.entityTypes[1];
|
|
189
|
-
user = setUp({ value: filterValue, entityType: entityType }).user;
|
|
190
|
-
attributeSelector = react_2.screen.getByTestId('attribute-selector');
|
|
191
|
-
return [4 /*yield*/, user.click((0, react_2.within)(attributeSelector).getByRole('combobox'))];
|
|
192
|
-
case 1:
|
|
193
|
-
_a.sent();
|
|
194
|
-
return [4 /*yield*/, user.click(react_2.screen.getByRole('menuitem', { name: 'Activity' }))];
|
|
195
|
-
case 2:
|
|
196
|
-
_a.sent();
|
|
197
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Apply'))];
|
|
198
|
-
case 3:
|
|
199
|
-
_a.sent();
|
|
200
|
-
expect(defaultProps.onApply).toHaveBeenCalledWith(__assign(__assign({}, filterValue), { attributes: [] }));
|
|
201
|
-
return [2 /*return*/];
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}); });
|
|
205
|
-
it('should clear attributes on entityTypes filter changes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
206
|
-
var filterValue, user, entityTypeSelector, newEntityTypes;
|
|
207
|
-
return __generator(this, function (_a) {
|
|
208
|
-
switch (_a.label) {
|
|
209
|
-
case 0:
|
|
210
|
-
filterValue = __assign(__assign({}, editor_test_data_1.value), { activities: [types_1.ActivityTypes.ENTITY_CHANGED] });
|
|
211
|
-
user = setUp({ value: filterValue }).user;
|
|
212
|
-
entityTypeSelector = react_2.screen.getByTestId('entity-types-selector');
|
|
213
|
-
return [4 /*yield*/, user.click((0, react_2.within)(entityTypeSelector).getByRole('combobox'))];
|
|
214
|
-
case 1:
|
|
215
|
-
_a.sent();
|
|
216
|
-
return [4 /*yield*/, user.click(react_2.screen.getByRole('option', { name: 'HCA' }))];
|
|
217
|
-
case 2:
|
|
218
|
-
_a.sent();
|
|
219
|
-
newEntityTypes = [editor_test_data_1.metadata.entityTypes[1]];
|
|
220
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Apply'))];
|
|
221
|
-
case 3:
|
|
222
|
-
_a.sent();
|
|
223
|
-
expect(defaultProps.onApply).toHaveBeenCalledWith(__assign(__assign({}, filterValue), { entityTypes: newEntityTypes, attributes: [] }));
|
|
224
|
-
return [2 /*return*/];
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}); });
|
|
228
|
-
it('should clear attributes, entityTypes, sources on activities filter changes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
229
|
-
var filterValue, entityType, user, activitySelector, textbox;
|
|
230
|
-
return __generator(this, function (_a) {
|
|
231
|
-
switch (_a.label) {
|
|
232
|
-
case 0:
|
|
233
|
-
filterValue = __assign(__assign({}, editor_test_data_1.value), { activities: [] });
|
|
234
|
-
entityType = { uri: 'test', attributes: [] };
|
|
235
|
-
user = setUp({ value: filterValue, entityType: entityType }).user;
|
|
236
|
-
activitySelector = react_2.screen.getByTestId('activity-selector');
|
|
237
|
-
textbox = (0, react_2.within)(activitySelector).getByRole('combobox');
|
|
238
|
-
return [4 /*yield*/, user.click(textbox)];
|
|
239
|
-
case 1:
|
|
240
|
-
_a.sent();
|
|
241
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Profile updated'))];
|
|
242
|
-
case 2:
|
|
243
|
-
_a.sent();
|
|
244
|
-
return [4 /*yield*/, user.click(react_2.screen.getByText('Apply'))];
|
|
245
|
-
case 3:
|
|
246
|
-
_a.sent();
|
|
247
|
-
expect(defaultProps.onApply).toHaveBeenCalledWith(__assign(__assign({}, filterValue), { activities: [types_1.ActivityTypes.ENTITY_CHANGED], attributes: [], sources: [], entityTypes: [] }));
|
|
248
|
-
return [2 /*return*/];
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}); });
|
|
252
|
-
});
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
-
if (ar || !(i in from)) {
|
|
16
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
var react_1 = __importDefault(require("react"));
|
|
27
|
-
var enzyme_1 = require("enzyme");
|
|
28
|
-
var ramda_1 = require("ramda");
|
|
29
|
-
var react_select_1 = __importDefault(require("react-select"));
|
|
30
|
-
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
31
|
-
var types_1 = require("../../../types");
|
|
32
|
-
var MultiSelect_1 = require("../../../../../MultiSelect");
|
|
33
|
-
var helpers_1 = require("../../helpers");
|
|
34
|
-
var ActivitySelector_1 = require("./ActivitySelector");
|
|
35
|
-
var options = [
|
|
36
|
-
{ value: 'COMMENT_ADDED', label: 'Comment added' },
|
|
37
|
-
{ value: 'COMMENT_DELETED', label: 'Comment deleted' },
|
|
38
|
-
{ value: 'COMMENT_UPDATED', label: 'Comment updated' },
|
|
39
|
-
{ value: 'ENTITIES_MERGED', label: 'Profile merged' },
|
|
40
|
-
{ value: 'ENTITIES_MERGED_MANUALLY', label: 'Profile merged manually' },
|
|
41
|
-
{ value: 'ENTITIES_MERGED_ON_THE_FLY', label: 'Profile merged on the fly' },
|
|
42
|
-
{ value: 'ENTITIES_SPLITTED', label: 'Profile un-merged' },
|
|
43
|
-
{ value: 'ENTITY_CHANGED', label: 'Profile updated' },
|
|
44
|
-
{ value: 'ENTITY_CREATED', label: 'Profile created' },
|
|
45
|
-
{ value: 'ENTITY_LOST_MERGE', label: 'Profile lost merge' },
|
|
46
|
-
{ value: 'ENTITY_REMOVED', label: 'Profile removed' },
|
|
47
|
-
{ value: 'MODEL_UPDATED', label: 'Model was updated' },
|
|
48
|
-
{ value: 'NOT_MATCHES_RESET', label: 'Not matches reset' },
|
|
49
|
-
{ value: 'NOT_MATCHES_SET', label: 'Not matches set' },
|
|
50
|
-
{ value: 'PERIODIC_TASK_SCHEDULED', label: 'Periodic task was scheduled' },
|
|
51
|
-
{ value: 'POTENTIAL_MATCHES_FOUND', label: 'Potential matches found' },
|
|
52
|
-
{ value: 'POTENTIAL_MATCHES_REMOVED', label: 'Potential matches removed' },
|
|
53
|
-
{ value: 'RELATIONSHIP_CHANGED', label: 'Relationship updated' },
|
|
54
|
-
{ value: 'RELATIONSHIP_CREATED', label: 'Relationship created' },
|
|
55
|
-
{ value: 'RELATIONSHIP_REMOVED', label: 'Relationship removed' },
|
|
56
|
-
{ value: 'USER_LOGIN', label: 'Logged in' },
|
|
57
|
-
{ value: 'USER_LOGOUT', label: 'Logged out' },
|
|
58
|
-
{ value: 'USER_PROFILE_VIEW', label: 'Profile viewed' },
|
|
59
|
-
{ value: 'USER_SEARCH', label: 'Searched' },
|
|
60
|
-
{ value: 'ANALYTICS_ATTRIBUTES_CHANGED', label: 'Analytics attribute changed' },
|
|
61
|
-
{ value: 'SFDC_CONNECTOR_SYNCHRONIZATION_ISSUE', label: 'SFDC connector synchronization issue' }
|
|
62
|
-
];
|
|
63
|
-
var profileOptions = [
|
|
64
|
-
{ value: 'ENTITIES_MERGED', label: 'Profile merged' },
|
|
65
|
-
{ value: 'ENTITIES_SPLITTED', label: 'Profile un-merged' },
|
|
66
|
-
{ value: 'ENTITY_CHANGED', label: 'Profile updated' },
|
|
67
|
-
{ value: 'ENTITY_CREATED', label: 'Profile created' },
|
|
68
|
-
{ value: 'NOT_MATCHES_RESET', label: 'Not matches reset' },
|
|
69
|
-
{ value: 'NOT_MATCHES_SET', label: 'Not matches set' },
|
|
70
|
-
{ value: 'POTENTIAL_MATCHES_FOUND', label: 'Potential matches found' },
|
|
71
|
-
{ value: 'POTENTIAL_MATCHES_REMOVED', label: 'Potential matches removed' },
|
|
72
|
-
{ value: 'RELATIONSHIP_CHANGED', label: 'Relationship updated' },
|
|
73
|
-
{ value: 'RELATIONSHIP_CREATED', label: 'Relationship created' },
|
|
74
|
-
{ value: 'RELATIONSHIP_REMOVED', label: 'Relationship removed' },
|
|
75
|
-
{ value: 'ENTITIES_MERGED_MANUALLY', label: 'Profile merged manually' },
|
|
76
|
-
{ value: 'ENTITIES_MERGED_ON_THE_FLY', label: 'Profile merged on the fly' },
|
|
77
|
-
{ value: 'ENTITY_LOST_MERGE', label: 'Profile lost merge' }
|
|
78
|
-
];
|
|
79
|
-
var groupOptions = [
|
|
80
|
-
{ value: 'GROUP_CHANGED', label: 'Group updated' },
|
|
81
|
-
{ value: 'GROUP_CREATED', label: 'Group created' },
|
|
82
|
-
{ value: 'GROUP_REMOVED', label: 'Group removed' }
|
|
83
|
-
];
|
|
84
|
-
var metadata = { entityTypes: [] };
|
|
85
|
-
describe('ActivitySelector tests', function () {
|
|
86
|
-
var props = {
|
|
87
|
-
activityTypes: (0, helpers_1.getSelectorActivityTypes)(metadata),
|
|
88
|
-
selectedActivityTypes: [types_1.ActivityTypes.MODEL_UPDATED, types_1.ActivityTypes.COMMENT_ADDED],
|
|
89
|
-
onChange: jest.fn()
|
|
90
|
-
};
|
|
91
|
-
var sortOptionsByLabel = (0, ramda_1.sortBy)((0, ramda_1.prop)('label'));
|
|
92
|
-
it('should render correct default state', function () {
|
|
93
|
-
var selectedOptions = [
|
|
94
|
-
{ value: 'MODEL_UPDATED', label: 'Model was updated' },
|
|
95
|
-
{ value: 'COMMENT_ADDED', label: 'Comment added' }
|
|
96
|
-
];
|
|
97
|
-
var wrapper = (0, enzyme_1.mount)(react_1.default.createElement(ActivitySelector_1.ActivitySelector, __assign({}, props)));
|
|
98
|
-
expect(wrapper.find(Typography_1.default).filterWhere(function (component) { return component.text() === 'Activity'; }).length).toBe(1);
|
|
99
|
-
expect(wrapper.find('.selectorHint')).toHaveLength(0);
|
|
100
|
-
var select = wrapper.find(MultiSelect_1.MultiSelect);
|
|
101
|
-
expect(select.length).toBe(1);
|
|
102
|
-
expect(sortOptionsByLabel(select.prop('options'))).toEqual(sortOptionsByLabel(options));
|
|
103
|
-
var isSearchableProp = wrapper.find(react_select_1.default).prop('isSearchable');
|
|
104
|
-
expect((0, ramda_1.isNil)(isSearchableProp) || isSearchableProp).toBe(true);
|
|
105
|
-
expect(sortOptionsByLabel(select.prop('value'))).toEqual(sortOptionsByLabel(selectedOptions));
|
|
106
|
-
});
|
|
107
|
-
it('should render group options if metadata has not empty groupTypes', function () {
|
|
108
|
-
var metadata = {
|
|
109
|
-
entityTypes: [],
|
|
110
|
-
groupTypes: [
|
|
111
|
-
{
|
|
112
|
-
uri: 'test',
|
|
113
|
-
dataLabel: '',
|
|
114
|
-
dataLabelPattern: '',
|
|
115
|
-
dataTooltipPattern: '',
|
|
116
|
-
description: '',
|
|
117
|
-
groupElements: {
|
|
118
|
-
entityTypeURIs: [],
|
|
119
|
-
uri: ''
|
|
120
|
-
},
|
|
121
|
-
hasPrimaryMember: false,
|
|
122
|
-
label: '',
|
|
123
|
-
memberTypes: [],
|
|
124
|
-
multiplePrimaryMembers: false,
|
|
125
|
-
type: ''
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
};
|
|
129
|
-
var fullOptions = sortOptionsByLabel(__spreadArray(__spreadArray([], options, true), groupOptions, true));
|
|
130
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivitySelector_1.ActivitySelector, __assign({}, props, { activityTypes: (0, helpers_1.getSelectorActivityTypes)(metadata) })));
|
|
131
|
-
expect(sortOptionsByLabel(wrapper.find(MultiSelect_1.MultiSelect).prop('options'))).toEqual(fullOptions);
|
|
132
|
-
});
|
|
133
|
-
it('should render profile options if entityType passed', function () {
|
|
134
|
-
var metadata = {
|
|
135
|
-
entityTypes: []
|
|
136
|
-
};
|
|
137
|
-
var activityTypes = (0, helpers_1.getSelectorActivityTypes)(metadata, { attributes: [], uri: '' });
|
|
138
|
-
var fullOptions = sortOptionsByLabel(profileOptions);
|
|
139
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivitySelector_1.ActivitySelector, __assign({}, props, { activityTypes: activityTypes })));
|
|
140
|
-
expect(sortOptionsByLabel(wrapper.find(MultiSelect_1.MultiSelect).prop('options'))).toEqual(fullOptions);
|
|
141
|
-
});
|
|
142
|
-
it('should call onChange when new option is selected', function () {
|
|
143
|
-
var newValues = [
|
|
144
|
-
{ value: 'COMMENT_UPDATED', label: 'Comment updated' },
|
|
145
|
-
{ value: 'NOT_MATCHES_RESET', label: 'Not matches reset' }
|
|
146
|
-
];
|
|
147
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivitySelector_1.ActivitySelector, __assign({}, props)));
|
|
148
|
-
var select = wrapper.find(MultiSelect_1.MultiSelect);
|
|
149
|
-
select.prop('onChange')(newValues);
|
|
150
|
-
expect(props.onChange).toHaveBeenCalledWith(['COMMENT_UPDATED', 'NOT_MATCHES_RESET']);
|
|
151
|
-
});
|
|
152
|
-
it('should show hint if activities length more then one and includes ENTITY_CHANGED', function () {
|
|
153
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ActivitySelector_1.ActivitySelector, __assign({}, props, { selectedActivityTypes: [types_1.ActivityTypes.ENTITY_CHANGED, types_1.ActivityTypes.NOT_MATCHES_RESET] })));
|
|
154
|
-
var hint = wrapper.find('.selectorHint');
|
|
155
|
-
expect(hint).toHaveLength(1);
|
|
156
|
-
expect(hint.text()).toBe('One at a time! Select a single Activity and any of its filters -OR- multiple Activities with no filters.');
|
|
157
|
-
});
|
|
158
|
-
});
|