@reltio/components 1.4.1996 → 1.4.1998

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