@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
|
@@ -0,0 +1,779 @@
|
|
|
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, within } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { DateRangeTypes, exportActivities, getAllUsersForTenant, getEntityType } from '@reltio/mdm-sdk';
|
|
52
|
+
import { showErrorMessage } from '../../../helpers/errors';
|
|
53
|
+
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
54
|
+
import { ActivityTypes } from '../types';
|
|
55
|
+
import { ActivityLogFilter } from './ActivityLogFilter';
|
|
56
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { exportActivities: jest.fn(), getAllUsersForTenant: jest.fn() })); });
|
|
57
|
+
jest.mock('../../../helpers/errors', function () { return (__assign(__assign({}, jest.requireActual('../../../helpers/errors')), { showErrorMessage: jest.fn() })); });
|
|
58
|
+
var defaultMetadata = {
|
|
59
|
+
entityTypes: [
|
|
60
|
+
{
|
|
61
|
+
uri: 'configuration/entityTypes/HCO',
|
|
62
|
+
label: 'HCO',
|
|
63
|
+
attributes: [
|
|
64
|
+
{
|
|
65
|
+
label: 'Name',
|
|
66
|
+
name: 'Name',
|
|
67
|
+
type: 'String',
|
|
68
|
+
uri: 'configuration/entityTypes/HCO/attributes/Name'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'Status',
|
|
72
|
+
name: 'Status',
|
|
73
|
+
type: 'String',
|
|
74
|
+
uri: 'configuration/entityTypes/HCO/attributes/Status'
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
uri: 'configuration/entityTypes/Company',
|
|
80
|
+
label: 'Company',
|
|
81
|
+
attributes: []
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
uri: 'configuration/entityTypes/HCP',
|
|
85
|
+
label: 'HCP',
|
|
86
|
+
attributes: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Boolean',
|
|
89
|
+
name: 'Boolean',
|
|
90
|
+
type: 'Boolean',
|
|
91
|
+
uri: 'configuration/entityTypes/HCP/attributes/Boolean'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: 'Number',
|
|
95
|
+
name: 'Number',
|
|
96
|
+
type: 'Number',
|
|
97
|
+
uri: 'configuration/entityTypes/HCP/attributes/Number'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'First Name',
|
|
101
|
+
name: 'FirstName',
|
|
102
|
+
type: 'String',
|
|
103
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: 'Last Name',
|
|
107
|
+
name: 'LastName',
|
|
108
|
+
type: 'String',
|
|
109
|
+
uri: 'configuration/entityTypes/HCP/attributes/LastName'
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
sources: [
|
|
115
|
+
{
|
|
116
|
+
uri: 'configuration/sources/IMS',
|
|
117
|
+
label: 'IMS',
|
|
118
|
+
icon: 'source/xyz.png',
|
|
119
|
+
abbreviation: 'IMS'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
uri: 'configuration/sources/MUI',
|
|
123
|
+
label: 'MUI',
|
|
124
|
+
icon: 'source/xyz.png',
|
|
125
|
+
abbreviation: 'MUI'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
uri: 'configuration/sources/MDS',
|
|
129
|
+
label: 'MDS',
|
|
130
|
+
icon: 'source/xyz.png',
|
|
131
|
+
abbreviation: 'MDS'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
uri: 'configuration/sources/SAC',
|
|
135
|
+
label: 'SAC',
|
|
136
|
+
icon: 'source/xyz.png',
|
|
137
|
+
abbreviation: 'SAC'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
uri: 'configuration/sources/SEED',
|
|
141
|
+
label: 'SEED',
|
|
142
|
+
icon: 'source/xyz.png',
|
|
143
|
+
abbreviation: 'SEED'
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
};
|
|
147
|
+
var defaultMdmValues = {
|
|
148
|
+
tenant: { id: 'alenat', name: 'alenat' },
|
|
149
|
+
user: {
|
|
150
|
+
serviceId: 'export',
|
|
151
|
+
resourcePath: ['data', 'activities'],
|
|
152
|
+
userPermissions: {
|
|
153
|
+
permissions: { 'export:data.activities': { EXECUTE: ['alenat'] } },
|
|
154
|
+
permissionsByService: {},
|
|
155
|
+
roles: {}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
metadata: defaultMetadata,
|
|
159
|
+
exportPath: '/nui/export'
|
|
160
|
+
};
|
|
161
|
+
var mdmModuleActions = { openConsoleApp: jest.fn() };
|
|
162
|
+
var defaultValue = {
|
|
163
|
+
users: [],
|
|
164
|
+
activities: [],
|
|
165
|
+
dateRange: { type: DateRangeTypes.WITHIN, period: [4, 'months'] }
|
|
166
|
+
};
|
|
167
|
+
var defaultProps = {
|
|
168
|
+
value: defaultValue,
|
|
169
|
+
entityType: getEntityType(defaultMetadata, 'configuration/entityTypes/HCO'),
|
|
170
|
+
onChange: jest.fn(),
|
|
171
|
+
exportTypes: ['json', 'csv'],
|
|
172
|
+
entityUri: 'entities/7Jsn1POn6'
|
|
173
|
+
};
|
|
174
|
+
var setUp = function (_a) {
|
|
175
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
176
|
+
var user = userEvent.setup();
|
|
177
|
+
var Providers = function (_a) {
|
|
178
|
+
var children = _a.children;
|
|
179
|
+
return (React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmModuleActions }, children));
|
|
180
|
+
};
|
|
181
|
+
var result = render(React.createElement(ActivityLogFilter, __assign({}, props)), { wrapper: Providers });
|
|
182
|
+
var rerender = function (props) { return result.rerender(React.createElement(ActivityLogFilter, __assign({}, defaultProps, props))); };
|
|
183
|
+
return __assign(__assign({}, result), { user: user, rerender: rerender });
|
|
184
|
+
};
|
|
185
|
+
describe('Activity log filter tests', function () {
|
|
186
|
+
beforeEach(function () {
|
|
187
|
+
jest.spyOn(Date, 'now').mockReturnValue(1636703406900);
|
|
188
|
+
exportActivities.mockResolvedValue({ status: 'scheduled' });
|
|
189
|
+
getAllUsersForTenant.mockResolvedValue([
|
|
190
|
+
{ email: 'alexey.nikonov@reltio.com', username: 'alexey.nikonov' },
|
|
191
|
+
{ email: 'fedor.petrov@reltio.com', username: 'fedor.petrov' },
|
|
192
|
+
{ email: 'ivan.ivanov@reltio.com', username: 'ivan.ivanov' }
|
|
193
|
+
]);
|
|
194
|
+
});
|
|
195
|
+
afterEach(function () {
|
|
196
|
+
jest.clearAllMocks();
|
|
197
|
+
});
|
|
198
|
+
it('should render filter label correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
199
|
+
var user;
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
switch (_a.label) {
|
|
202
|
+
case 0:
|
|
203
|
+
user = setUp().user;
|
|
204
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
205
|
+
return [4 /*yield*/, user.hover(screen.getByText('Within 4 months'))];
|
|
206
|
+
case 1:
|
|
207
|
+
_a.sent();
|
|
208
|
+
screen.getByRole('tooltip', { name: 'Within 4 months' });
|
|
209
|
+
return [4 /*yield*/, user.hover(screen.getByText('Filter:'))];
|
|
210
|
+
case 2:
|
|
211
|
+
_a.sent();
|
|
212
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
213
|
+
return [2 /*return*/];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}); });
|
|
217
|
+
it('should not render export button if there is no CAN_EXPORT_ACTIVITIES permission', function () {
|
|
218
|
+
var mdmValues = __assign(__assign({}, defaultMdmValues), { user: __assign(__assign({}, defaultMdmValues.user), { userPermissions: { permissions: {}, permissionsByService: {}, roles: {} } }) });
|
|
219
|
+
setUp({ mdmValues: mdmValues });
|
|
220
|
+
expect(screen.queryByLabelText('Export')).not.toBeInTheDocument();
|
|
221
|
+
});
|
|
222
|
+
it('should show tooltip on export button hover correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var user;
|
|
224
|
+
return __generator(this, function (_a) {
|
|
225
|
+
switch (_a.label) {
|
|
226
|
+
case 0:
|
|
227
|
+
user = setUp().user;
|
|
228
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
229
|
+
return [4 /*yield*/, user.hover(screen.getByLabelText('Export'))];
|
|
230
|
+
case 1:
|
|
231
|
+
_a.sent();
|
|
232
|
+
screen.getByRole('tooltip', { name: 'Export' });
|
|
233
|
+
return [4 /*yield*/, user.hover(screen.getByText('Filter:'))];
|
|
234
|
+
case 2:
|
|
235
|
+
_a.sent();
|
|
236
|
+
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
237
|
+
return [2 /*return*/];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}); });
|
|
241
|
+
it('should show dropdown menu on export button click correctly if exportTypes is not empty', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
242
|
+
var user, menuItems;
|
|
243
|
+
return __generator(this, function (_a) {
|
|
244
|
+
switch (_a.label) {
|
|
245
|
+
case 0:
|
|
246
|
+
user = setUp().user;
|
|
247
|
+
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
|
248
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Export'))];
|
|
249
|
+
case 1:
|
|
250
|
+
_a.sent();
|
|
251
|
+
menuItems = within(screen.getByRole('presentation')).getAllByRole('menuitem');
|
|
252
|
+
expect(menuItems).toHaveLength(2);
|
|
253
|
+
expect(menuItems[0]).toHaveTextContent('JSON');
|
|
254
|
+
expect(menuItems[1]).toHaveTextContent('CSV');
|
|
255
|
+
return [4 /*yield*/, user.keyboard('{Escape}')];
|
|
256
|
+
case 2:
|
|
257
|
+
_a.sent();
|
|
258
|
+
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
|
259
|
+
return [2 /*return*/];
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}); });
|
|
263
|
+
it('should export activities on export button click correctly if exportTypes is empty', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
264
|
+
var props, user, alert;
|
|
265
|
+
return __generator(this, function (_a) {
|
|
266
|
+
switch (_a.label) {
|
|
267
|
+
case 0:
|
|
268
|
+
props = __assign(__assign({}, defaultProps), { exportTypes: [] });
|
|
269
|
+
user = setUp({ props: props }).user;
|
|
270
|
+
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
271
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Export'))];
|
|
272
|
+
case 1:
|
|
273
|
+
_a.sent();
|
|
274
|
+
expect(exportActivities).toHaveBeenCalledWith({
|
|
275
|
+
exportPath: '/nui/export',
|
|
276
|
+
options: {
|
|
277
|
+
fileFormat: undefined,
|
|
278
|
+
filter: "(gte(timestamp, 1626076206900)) and (equals(items.objectUri, 'entities/7Jsn1POn6') or equals(items.startObjectUri, 'entities/7Jsn1POn6') or equals(items.endObjectUri, 'entities/7Jsn1POn6')) and (not equals(user, 'collaboration-service'))"
|
|
279
|
+
},
|
|
280
|
+
tenant: 'alenat'
|
|
281
|
+
});
|
|
282
|
+
alert = screen.getByRole('alert');
|
|
283
|
+
within(alert).getByText('Export operation is currently in progress. You will receive an email notification once completed. Go to Export Application to view the status.');
|
|
284
|
+
return [4 /*yield*/, user.click(within(alert).getByText('Export application'))];
|
|
285
|
+
case 2:
|
|
286
|
+
_a.sent();
|
|
287
|
+
expect(mdmModuleActions.openConsoleApp).toHaveBeenCalledWith('Export');
|
|
288
|
+
return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}); });
|
|
292
|
+
it('should export activities on export item click correctly if exportTypes is not empty', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
293
|
+
var user, alert;
|
|
294
|
+
return __generator(this, function (_a) {
|
|
295
|
+
switch (_a.label) {
|
|
296
|
+
case 0:
|
|
297
|
+
user = setUp().user;
|
|
298
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Export'))];
|
|
299
|
+
case 1:
|
|
300
|
+
_a.sent();
|
|
301
|
+
return [4 /*yield*/, user.click(screen.getByText('JSON'))];
|
|
302
|
+
case 2:
|
|
303
|
+
_a.sent();
|
|
304
|
+
expect(exportActivities).toHaveBeenCalledWith({
|
|
305
|
+
exportPath: '/nui/export',
|
|
306
|
+
options: {
|
|
307
|
+
fileFormat: 'json',
|
|
308
|
+
filter: "(gte(timestamp, 1626076206900)) and (equals(items.objectUri, 'entities/7Jsn1POn6') or equals(items.startObjectUri, 'entities/7Jsn1POn6') or equals(items.endObjectUri, 'entities/7Jsn1POn6')) and (not equals(user, 'collaboration-service'))"
|
|
309
|
+
},
|
|
310
|
+
tenant: 'alenat'
|
|
311
|
+
});
|
|
312
|
+
alert = screen.getByRole('alert');
|
|
313
|
+
within(alert).getByText('Export operation is currently in progress. You will receive an email notification once completed. Go to Export Application to view the status.');
|
|
314
|
+
within(alert).getByText('Export application');
|
|
315
|
+
return [2 /*return*/];
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}); });
|
|
319
|
+
it('should show error message instead of snackbar on export item click if request has been rejected', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
320
|
+
var user;
|
|
321
|
+
return __generator(this, function (_a) {
|
|
322
|
+
switch (_a.label) {
|
|
323
|
+
case 0:
|
|
324
|
+
exportActivities.mockRejectedValue({ errorMessage: 'Something went wrong' });
|
|
325
|
+
user = setUp().user;
|
|
326
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Export'))];
|
|
327
|
+
case 1:
|
|
328
|
+
_a.sent();
|
|
329
|
+
return [4 /*yield*/, user.click(screen.getByText('CSV'))];
|
|
330
|
+
case 2:
|
|
331
|
+
_a.sent();
|
|
332
|
+
expect(exportActivities).toHaveBeenCalledWith({
|
|
333
|
+
exportPath: '/nui/export',
|
|
334
|
+
options: {
|
|
335
|
+
fileFormat: 'csv',
|
|
336
|
+
filter: "(gte(timestamp, 1626076206900)) and (equals(items.objectUri, 'entities/7Jsn1POn6') or equals(items.startObjectUri, 'entities/7Jsn1POn6') or equals(items.endObjectUri, 'entities/7Jsn1POn6')) and (not equals(user, 'collaboration-service'))"
|
|
337
|
+
},
|
|
338
|
+
tenant: 'alenat'
|
|
339
|
+
});
|
|
340
|
+
expect(showErrorMessage).toHaveBeenCalledWith({ errorMessage: 'Something went wrong' }, { defaultMessage: "Can't export activities", title: 'Error' });
|
|
341
|
+
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
|
342
|
+
return [2 /*return*/];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}); });
|
|
346
|
+
it('activity selector should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
347
|
+
var hintText, user, activitySelector, options;
|
|
348
|
+
return __generator(this, function (_a) {
|
|
349
|
+
switch (_a.label) {
|
|
350
|
+
case 0:
|
|
351
|
+
hintText = 'One at a time! Select a single Activity and any of its filters -OR- multiple Activities with no filters.';
|
|
352
|
+
user = setUp().user;
|
|
353
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
354
|
+
case 1:
|
|
355
|
+
_a.sent();
|
|
356
|
+
expect(screen.queryByText(hintText)).not.toBeInTheDocument();
|
|
357
|
+
activitySelector = within(screen.getByTestId('activity-selector')).getByRole('combobox');
|
|
358
|
+
return [4 /*yield*/, user.click(activitySelector)];
|
|
359
|
+
case 2:
|
|
360
|
+
_a.sent();
|
|
361
|
+
options = screen.getAllByRole('option');
|
|
362
|
+
expect(options).toHaveLength(14);
|
|
363
|
+
expect(options[0]).toHaveTextContent('Not matches reset');
|
|
364
|
+
expect(options[1]).toHaveTextContent('Not matches set');
|
|
365
|
+
expect(options[2]).toHaveTextContent('Potential matches found');
|
|
366
|
+
expect(options[3]).toHaveTextContent('Potential matches removed');
|
|
367
|
+
expect(options[4]).toHaveTextContent('Profile created');
|
|
368
|
+
expect(options[5]).toHaveTextContent('Profile lost merge');
|
|
369
|
+
expect(options[6]).toHaveTextContent('Profile merged');
|
|
370
|
+
expect(options[7]).toHaveTextContent('Profile merged manually');
|
|
371
|
+
expect(options[8]).toHaveTextContent('Profile merged on the fly');
|
|
372
|
+
expect(options[9]).toHaveTextContent('Profile un-merged');
|
|
373
|
+
expect(options[10]).toHaveTextContent('Profile updated');
|
|
374
|
+
expect(options[11]).toHaveTextContent('Relationship created');
|
|
375
|
+
expect(options[12]).toHaveTextContent('Relationship removed');
|
|
376
|
+
expect(options[13]).toHaveTextContent('Relationship updated');
|
|
377
|
+
return [4 /*yield*/, user.click(screen.getByText('Potential matches found'))];
|
|
378
|
+
case 3:
|
|
379
|
+
_a.sent();
|
|
380
|
+
expect(screen.queryByText(hintText)).not.toBeInTheDocument();
|
|
381
|
+
return [4 /*yield*/, user.click(activitySelector)];
|
|
382
|
+
case 4:
|
|
383
|
+
_a.sent();
|
|
384
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile created'))];
|
|
385
|
+
case 5:
|
|
386
|
+
_a.sent();
|
|
387
|
+
expect(screen.queryByText(hintText)).not.toBeInTheDocument();
|
|
388
|
+
return [4 /*yield*/, user.click(activitySelector)];
|
|
389
|
+
case 6:
|
|
390
|
+
_a.sent();
|
|
391
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
392
|
+
case 7:
|
|
393
|
+
_a.sent();
|
|
394
|
+
screen.getByText(hintText);
|
|
395
|
+
return [2 /*return*/];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}); });
|
|
399
|
+
it('should render correct additional selectors for "Profile updated" activity if entityType is passed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
400
|
+
var user;
|
|
401
|
+
return __generator(this, function (_a) {
|
|
402
|
+
switch (_a.label) {
|
|
403
|
+
case 0:
|
|
404
|
+
user = setUp().user;
|
|
405
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
406
|
+
case 1:
|
|
407
|
+
_a.sent();
|
|
408
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
409
|
+
case 2:
|
|
410
|
+
_a.sent();
|
|
411
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
412
|
+
case 3:
|
|
413
|
+
_a.sent();
|
|
414
|
+
screen.getByTestId('attribute-selector');
|
|
415
|
+
screen.getByTestId('source-selector');
|
|
416
|
+
expect(screen.queryByTestId('entity-types-selector')).not.toBeInTheDocument();
|
|
417
|
+
return [2 /*return*/];
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}); });
|
|
421
|
+
it('should render correct additional selectors for "Profile updated" activity if entityType is not passed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
422
|
+
var props, user;
|
|
423
|
+
return __generator(this, function (_a) {
|
|
424
|
+
switch (_a.label) {
|
|
425
|
+
case 0:
|
|
426
|
+
props = __assign(__assign({}, defaultProps), { entityType: null });
|
|
427
|
+
user = setUp({ props: props }).user;
|
|
428
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
429
|
+
case 1:
|
|
430
|
+
_a.sent();
|
|
431
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
432
|
+
case 2:
|
|
433
|
+
_a.sent();
|
|
434
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
435
|
+
case 3:
|
|
436
|
+
_a.sent();
|
|
437
|
+
screen.getByTestId('attribute-selector');
|
|
438
|
+
screen.getByTestId('source-selector');
|
|
439
|
+
screen.getByTestId('entity-types-selector');
|
|
440
|
+
return [2 /*return*/];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}); });
|
|
444
|
+
it('should fill filter editor and apply it correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
445
|
+
var props, _a, user, rerender, filterButton, popover, entityTypesOptions, attributesOptions, sourcesOptions, _b, dateIntervalSelector, usersOptions, newFilters;
|
|
446
|
+
return __generator(this, function (_c) {
|
|
447
|
+
switch (_c.label) {
|
|
448
|
+
case 0:
|
|
449
|
+
props = __assign(__assign({}, defaultProps), { entityType: null });
|
|
450
|
+
_a = setUp({ props: props }), user = _a.user, rerender = _a.rerender;
|
|
451
|
+
filterButton = screen.getByLabelText('Filter');
|
|
452
|
+
expect(filterButton).not.toHaveClass('activeIcon');
|
|
453
|
+
return [4 /*yield*/, user.click(filterButton)];
|
|
454
|
+
case 1:
|
|
455
|
+
_c.sent();
|
|
456
|
+
popover = screen.getByRole('presentation');
|
|
457
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
458
|
+
case 2:
|
|
459
|
+
_c.sent();
|
|
460
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
461
|
+
case 3:
|
|
462
|
+
_c.sent();
|
|
463
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('entity-types-selector')).getByRole('combobox'))];
|
|
464
|
+
case 4:
|
|
465
|
+
_c.sent();
|
|
466
|
+
entityTypesOptions = screen.getAllByRole('option');
|
|
467
|
+
expect(entityTypesOptions).toHaveLength(3);
|
|
468
|
+
expect(entityTypesOptions[0]).toHaveTextContent('Company');
|
|
469
|
+
expect(entityTypesOptions[1]).toHaveTextContent('HCO');
|
|
470
|
+
expect(entityTypesOptions[2]).toHaveTextContent('HCP');
|
|
471
|
+
return [4 /*yield*/, user.click(screen.getByText('HCP'))];
|
|
472
|
+
case 5:
|
|
473
|
+
_c.sent();
|
|
474
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('attribute-selector')).getByRole('combobox'))];
|
|
475
|
+
case 6:
|
|
476
|
+
_c.sent();
|
|
477
|
+
attributesOptions = screen.getAllByRole('option');
|
|
478
|
+
expect(attributesOptions).toHaveLength(4);
|
|
479
|
+
expect(attributesOptions[0]).toHaveTextContent('Boolean');
|
|
480
|
+
expect(attributesOptions[1]).toHaveTextContent('Number');
|
|
481
|
+
expect(attributesOptions[2]).toHaveTextContent('First Name');
|
|
482
|
+
expect(attributesOptions[3]).toHaveTextContent('Last Name');
|
|
483
|
+
return [4 /*yield*/, user.click(screen.getByText('First Name'))];
|
|
484
|
+
case 7:
|
|
485
|
+
_c.sent();
|
|
486
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('source-selector')).getByRole('combobox'))];
|
|
487
|
+
case 8:
|
|
488
|
+
_c.sent();
|
|
489
|
+
sourcesOptions = screen.getAllByRole('option');
|
|
490
|
+
expect(sourcesOptions).toHaveLength(5);
|
|
491
|
+
expect(sourcesOptions[0]).toHaveTextContent('IMS');
|
|
492
|
+
expect(sourcesOptions[1]).toHaveTextContent('MDS');
|
|
493
|
+
expect(sourcesOptions[2]).toHaveTextContent('MUI');
|
|
494
|
+
expect(sourcesOptions[3]).toHaveTextContent('SAC');
|
|
495
|
+
expect(sourcesOptions[4]).toHaveTextContent('SEED');
|
|
496
|
+
return [4 /*yield*/, user.click(screen.getByText('MUI'))];
|
|
497
|
+
case 9:
|
|
498
|
+
_c.sent();
|
|
499
|
+
return [4 /*yield*/, user.click(screen.getByText('More than'))];
|
|
500
|
+
case 10:
|
|
501
|
+
_c.sent();
|
|
502
|
+
_b = screen.getAllByTestId('date-interval-selector'), dateIntervalSelector = _b[1];
|
|
503
|
+
return [4 /*yield*/, user.type(within(dateIntervalSelector).getByRole('spinbutton'), '10')];
|
|
504
|
+
case 11:
|
|
505
|
+
_c.sent();
|
|
506
|
+
return [4 /*yield*/, user.click(within(dateIntervalSelector).getByRole('combobox'))];
|
|
507
|
+
case 12:
|
|
508
|
+
_c.sent();
|
|
509
|
+
return [4 /*yield*/, user.click(screen.getByText('Days'))];
|
|
510
|
+
case 13:
|
|
511
|
+
_c.sent();
|
|
512
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('user-selector')).getByRole('combobox'))];
|
|
513
|
+
case 14:
|
|
514
|
+
_c.sent();
|
|
515
|
+
usersOptions = screen.getAllByRole('option');
|
|
516
|
+
expect(usersOptions).toHaveLength(3);
|
|
517
|
+
expect(usersOptions[0]).toHaveTextContent('alexey.nikonov');
|
|
518
|
+
expect(usersOptions[1]).toHaveTextContent('fedor.petrov');
|
|
519
|
+
expect(usersOptions[2]).toHaveTextContent('ivan.ivanov');
|
|
520
|
+
return [4 /*yield*/, user.click(screen.getByText('fedor.petrov'))];
|
|
521
|
+
case 15:
|
|
522
|
+
_c.sent();
|
|
523
|
+
return [4 /*yield*/, user.click(screen.getByText('Apply'))];
|
|
524
|
+
case 16:
|
|
525
|
+
_c.sent();
|
|
526
|
+
newFilters = {
|
|
527
|
+
activities: [ActivityTypes.ENTITY_CHANGED],
|
|
528
|
+
attributes: [
|
|
529
|
+
{
|
|
530
|
+
attrType: {
|
|
531
|
+
label: 'First Name',
|
|
532
|
+
name: 'FirstName',
|
|
533
|
+
type: 'String',
|
|
534
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
535
|
+
},
|
|
536
|
+
chipLabel: 'First Name',
|
|
537
|
+
label: 'First Name',
|
|
538
|
+
level: 0,
|
|
539
|
+
value: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
dateRange: { period: [10, 'days'], type: DateRangeTypes.AGO },
|
|
543
|
+
entityTypes: [
|
|
544
|
+
{
|
|
545
|
+
attributes: [
|
|
546
|
+
{
|
|
547
|
+
label: 'Boolean',
|
|
548
|
+
name: 'Boolean',
|
|
549
|
+
type: 'Boolean',
|
|
550
|
+
uri: 'configuration/entityTypes/HCP/attributes/Boolean'
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
label: 'Number',
|
|
554
|
+
name: 'Number',
|
|
555
|
+
type: 'Number',
|
|
556
|
+
uri: 'configuration/entityTypes/HCP/attributes/Number'
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
label: 'First Name',
|
|
560
|
+
name: 'FirstName',
|
|
561
|
+
type: 'String',
|
|
562
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
label: 'Last Name',
|
|
566
|
+
name: 'LastName',
|
|
567
|
+
type: 'String',
|
|
568
|
+
uri: 'configuration/entityTypes/HCP/attributes/LastName'
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
label: 'HCP',
|
|
572
|
+
uri: 'configuration/entityTypes/HCP'
|
|
573
|
+
}
|
|
574
|
+
],
|
|
575
|
+
sources: [{ abbreviation: 'MUI', icon: 'source/xyz.png', label: 'MUI', uri: 'configuration/sources/MUI' }],
|
|
576
|
+
users: ['fedor.petrov']
|
|
577
|
+
};
|
|
578
|
+
expect(props.onChange).toHaveBeenCalledWith(newFilters);
|
|
579
|
+
expect(popover).not.toBeInTheDocument();
|
|
580
|
+
rerender({ value: newFilters });
|
|
581
|
+
screen.getByText('Profile updated | HCP | First Name | MUI | More than 10 days ago | fedor.petrov');
|
|
582
|
+
expect(filterButton).toHaveClass('activeIcon');
|
|
583
|
+
return [2 /*return*/];
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}); });
|
|
587
|
+
it('should use entity type from entityType prop if it is passed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
588
|
+
var user, attributesOptions;
|
|
589
|
+
return __generator(this, function (_a) {
|
|
590
|
+
switch (_a.label) {
|
|
591
|
+
case 0:
|
|
592
|
+
user = setUp().user;
|
|
593
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
594
|
+
case 1:
|
|
595
|
+
_a.sent();
|
|
596
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
597
|
+
case 2:
|
|
598
|
+
_a.sent();
|
|
599
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
600
|
+
case 3:
|
|
601
|
+
_a.sent();
|
|
602
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('attribute-selector')).getByRole('combobox'))];
|
|
603
|
+
case 4:
|
|
604
|
+
_a.sent();
|
|
605
|
+
attributesOptions = screen.getAllByRole('option');
|
|
606
|
+
expect(attributesOptions).toHaveLength(2);
|
|
607
|
+
expect(attributesOptions[0]).toHaveTextContent('Name');
|
|
608
|
+
expect(attributesOptions[1]).toHaveTextContent('Status');
|
|
609
|
+
return [2 /*return*/];
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
}); });
|
|
613
|
+
it('should clear filters correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
614
|
+
var user, activitySelector, userSelector;
|
|
615
|
+
return __generator(this, function (_a) {
|
|
616
|
+
switch (_a.label) {
|
|
617
|
+
case 0:
|
|
618
|
+
user = setUp().user;
|
|
619
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
620
|
+
case 1:
|
|
621
|
+
_a.sent();
|
|
622
|
+
activitySelector = screen.getByTestId('activity-selector');
|
|
623
|
+
userSelector = screen.getByTestId('user-selector');
|
|
624
|
+
return [4 /*yield*/, user.click(within(activitySelector).getByRole('combobox'))];
|
|
625
|
+
case 2:
|
|
626
|
+
_a.sent();
|
|
627
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile created'))];
|
|
628
|
+
case 3:
|
|
629
|
+
_a.sent();
|
|
630
|
+
return [4 /*yield*/, user.click(within(userSelector).getByRole('combobox'))];
|
|
631
|
+
case 4:
|
|
632
|
+
_a.sent();
|
|
633
|
+
return [4 /*yield*/, user.click(screen.getByText('fedor.petrov'))];
|
|
634
|
+
case 5:
|
|
635
|
+
_a.sent();
|
|
636
|
+
within(activitySelector).getByText('Profile created');
|
|
637
|
+
within(userSelector).getByText('fedor.petrov');
|
|
638
|
+
return [4 /*yield*/, user.click(screen.getByText('Clear all'))];
|
|
639
|
+
case 6:
|
|
640
|
+
_a.sent();
|
|
641
|
+
expect(within(activitySelector).queryByRole('button')).not.toBeInTheDocument();
|
|
642
|
+
expect(within(userSelector).queryByRole('button')).not.toBeInTheDocument();
|
|
643
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith({
|
|
644
|
+
activities: [],
|
|
645
|
+
dateRange: { period: [4, 'months'], type: 'within' },
|
|
646
|
+
users: []
|
|
647
|
+
});
|
|
648
|
+
return [2 /*return*/];
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}); });
|
|
652
|
+
it('should apply previous date range value if current value is not valid', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
653
|
+
var user;
|
|
654
|
+
return __generator(this, function (_a) {
|
|
655
|
+
switch (_a.label) {
|
|
656
|
+
case 0:
|
|
657
|
+
user = setUp().user;
|
|
658
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
659
|
+
case 1:
|
|
660
|
+
_a.sent();
|
|
661
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
662
|
+
case 2:
|
|
663
|
+
_a.sent();
|
|
664
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile created'))];
|
|
665
|
+
case 3:
|
|
666
|
+
_a.sent();
|
|
667
|
+
return [4 /*yield*/, user.click(screen.getByText('More than'))];
|
|
668
|
+
case 4:
|
|
669
|
+
_a.sent();
|
|
670
|
+
return [4 /*yield*/, user.click(screen.getByText('Apply'))];
|
|
671
|
+
case 5:
|
|
672
|
+
_a.sent();
|
|
673
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith({
|
|
674
|
+
activities: ['ENTITY_CREATED'],
|
|
675
|
+
attributes: [],
|
|
676
|
+
dateRange: { period: [4, 'months'], type: 'within' },
|
|
677
|
+
entityTypes: [],
|
|
678
|
+
sources: [],
|
|
679
|
+
users: []
|
|
680
|
+
});
|
|
681
|
+
return [2 /*return*/];
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
}); });
|
|
685
|
+
it('should clear attribute filter on change entity type', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
686
|
+
var props, user;
|
|
687
|
+
return __generator(this, function (_a) {
|
|
688
|
+
switch (_a.label) {
|
|
689
|
+
case 0:
|
|
690
|
+
props = __assign(__assign({}, defaultProps), { entityType: null });
|
|
691
|
+
user = setUp({ props: props }).user;
|
|
692
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
693
|
+
case 1:
|
|
694
|
+
_a.sent();
|
|
695
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
696
|
+
case 2:
|
|
697
|
+
_a.sent();
|
|
698
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
699
|
+
case 3:
|
|
700
|
+
_a.sent();
|
|
701
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('entity-types-selector')).getByRole('combobox'))];
|
|
702
|
+
case 4:
|
|
703
|
+
_a.sent();
|
|
704
|
+
return [4 /*yield*/, user.click(screen.getByText('HCP'))];
|
|
705
|
+
case 5:
|
|
706
|
+
_a.sent();
|
|
707
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('attribute-selector')).getByRole('combobox'))];
|
|
708
|
+
case 6:
|
|
709
|
+
_a.sent();
|
|
710
|
+
return [4 /*yield*/, user.click(screen.getByText('Boolean'))];
|
|
711
|
+
case 7:
|
|
712
|
+
_a.sent();
|
|
713
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('entity-types-selector')).getByRole('combobox'))];
|
|
714
|
+
case 8:
|
|
715
|
+
_a.sent();
|
|
716
|
+
return [4 /*yield*/, user.click(screen.getByText('HCO'))];
|
|
717
|
+
case 9:
|
|
718
|
+
_a.sent();
|
|
719
|
+
expect(within(screen.getByTestId('attribute-selector')).queryByRole('button')).not.toBeInTheDocument();
|
|
720
|
+
return [2 /*return*/];
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}); });
|
|
724
|
+
it('should clear entity types, attribute and source filters on change activities', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
725
|
+
var props, user;
|
|
726
|
+
return __generator(this, function (_a) {
|
|
727
|
+
switch (_a.label) {
|
|
728
|
+
case 0:
|
|
729
|
+
props = __assign(__assign({}, defaultProps), { entityType: null });
|
|
730
|
+
user = setUp({ props: props }).user;
|
|
731
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Filter'))];
|
|
732
|
+
case 1:
|
|
733
|
+
_a.sent();
|
|
734
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
735
|
+
case 2:
|
|
736
|
+
_a.sent();
|
|
737
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile updated'))];
|
|
738
|
+
case 3:
|
|
739
|
+
_a.sent();
|
|
740
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('entity-types-selector')).getByRole('combobox'))];
|
|
741
|
+
case 4:
|
|
742
|
+
_a.sent();
|
|
743
|
+
return [4 /*yield*/, user.click(screen.getByText('HCP'))];
|
|
744
|
+
case 5:
|
|
745
|
+
_a.sent();
|
|
746
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('attribute-selector')).getByRole('combobox'))];
|
|
747
|
+
case 6:
|
|
748
|
+
_a.sent();
|
|
749
|
+
return [4 /*yield*/, user.click(screen.getByText('Boolean'))];
|
|
750
|
+
case 7:
|
|
751
|
+
_a.sent();
|
|
752
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('source-selector')).getByRole('combobox'))];
|
|
753
|
+
case 8:
|
|
754
|
+
_a.sent();
|
|
755
|
+
return [4 /*yield*/, user.click(screen.getByText('IMS'))];
|
|
756
|
+
case 9:
|
|
757
|
+
_a.sent();
|
|
758
|
+
return [4 /*yield*/, user.click(within(screen.getByTestId('activity-selector')).getByRole('combobox'))];
|
|
759
|
+
case 10:
|
|
760
|
+
_a.sent();
|
|
761
|
+
return [4 /*yield*/, user.click(screen.getByText('Profile created'))];
|
|
762
|
+
case 11:
|
|
763
|
+
_a.sent();
|
|
764
|
+
return [4 /*yield*/, user.click(screen.getByText('Apply'))];
|
|
765
|
+
case 12:
|
|
766
|
+
_a.sent();
|
|
767
|
+
expect(props.onChange).toHaveBeenCalledWith({
|
|
768
|
+
activities: [ActivityTypes.ENTITY_CHANGED, ActivityTypes.ENTITY_CREATED],
|
|
769
|
+
attributes: [],
|
|
770
|
+
dateRange: { period: [4, 'months'], type: DateRangeTypes.WITHIN },
|
|
771
|
+
entityTypes: [],
|
|
772
|
+
sources: [],
|
|
773
|
+
users: []
|
|
774
|
+
});
|
|
775
|
+
return [2 /*return*/];
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
}); });
|
|
779
|
+
});
|