@reltio/components 1.4.2027 → 1.4.2029
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/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +0 -1
- package/cjs/features/graph/SigmaGraphContainer/SigmaGraphContainer.test.js +5 -14
- package/cjs/features/graph/SigmaGraphResizer/SigmaGraphResizer.test.js +11 -9
- package/cjs/features/graph/ZoomSlider/ZoomSlider.js +2 -2
- package/cjs/features/graph/ZoomSlider/ZoomSlider.test.js +85 -37
- package/cjs/features/history/DateRangeSelector/DateRangeSelector.specs.js +188 -117
- package/cjs/features/history/HistoryFilterButton/HistoryFilterButton.js +1 -1
- package/cjs/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.specs.js +38 -41
- package/cjs/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +17 -16
- package/cjs/features/history/HistoryHeader/HistoryHeader.spec.js +21 -31
- package/cjs/features/history/HistoryPanelEmptyState/HistoryPanelEmptyState.specs.js +4 -9
- package/cjs/features/history/HistoryRow/HistoryRow.js +1 -1
- package/cjs/features/history/HistoryRow/HistoryRow.specs.js +74 -34
- package/cjs/features/history/HistoryTree/HistoryTree.js +1 -1
- package/cjs/features/history/HistoryView/HistoryView.specs.js +77 -43
- package/cjs/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +83 -34
- package/cjs/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +20 -0
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.js +1 -1
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.js +1 -1
- package/cjs/features/workflow/AttributesChanges/components/ShowMoreLink/ShowMoreLink.spec.js +81 -24
- package/cjs/features/workflow/DueDateField/DueDateField.spec.js +51 -102
- package/cjs/features/workflow/PrioritySelector/PrioritySelector.spec.js +62 -133
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +438 -124
- package/cjs/features/workflow/hooks/useChangeRequest.specs.js +17 -27
- package/cjs/features/workflow/hooks/useWorkflowColor.specs.js +23 -47
- package/cjs/features/workflow/hooks/useWorkflowDefinitions.js +5 -1
- package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +0 -1
- package/features/graph/SigmaGraphContainer/SigmaGraphContainer.test.js +5 -14
- package/features/graph/SigmaGraphResizer/SigmaGraphResizer.test.js +11 -9
- package/features/graph/ZoomSlider/ZoomSlider.js +2 -2
- package/features/graph/ZoomSlider/ZoomSlider.test.js +85 -37
- package/features/history/DateRangeSelector/DateRangeSelector.specs.js +188 -117
- package/features/history/HistoryFilterButton/HistoryFilterButton.js +1 -1
- package/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.specs.js +38 -41
- package/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +17 -16
- package/features/history/HistoryHeader/HistoryHeader.spec.js +21 -31
- package/features/history/HistoryPanelEmptyState/HistoryPanelEmptyState.specs.js +4 -9
- package/features/history/HistoryRow/HistoryRow.js +1 -1
- package/features/history/HistoryRow/HistoryRow.specs.js +74 -34
- package/features/history/HistoryTree/HistoryTree.js +1 -1
- package/features/history/HistoryView/HistoryView.specs.js +77 -43
- package/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +83 -34
- package/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +20 -0
- package/features/workflow/AttributesChanges/AttributesChanges.js +1 -1
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.js +1 -1
- package/features/workflow/AttributesChanges/components/ShowMoreLink/ShowMoreLink.spec.js +81 -24
- package/features/workflow/DueDateField/DueDateField.spec.js +51 -102
- package/features/workflow/PrioritySelector/PrioritySelector.spec.js +62 -133
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +439 -125
- package/features/workflow/hooks/useChangeRequest.specs.js +17 -24
- package/features/workflow/hooks/useWorkflowColor.specs.js +23 -44
- package/features/workflow/hooks/useWorkflowDefinitions.js +5 -1
- package/package.json +1 -1
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.spec.js +0 -249
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.js +0 -44
- package/cjs/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.js +0 -38
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.js +0 -218
- package/features/workflow/AttributesChanges/AttributesChanges.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/AttributesChanges.spec.js +0 -244
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.js +0 -39
- package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.js +0 -33
- package/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.js +0 -213
|
@@ -46,157 +46,471 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
49
58
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
60
|
};
|
|
52
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
62
|
var react_1 = __importDefault(require("react"));
|
|
54
|
-
var
|
|
55
|
-
var
|
|
63
|
+
var react_2 = require("@testing-library/react");
|
|
64
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
65
|
+
var moment_1 = __importDefault(require("moment"));
|
|
66
|
+
var LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
67
|
+
var AdapterMoment_1 = require("@mui/x-date-pickers/AdapterMoment");
|
|
56
68
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
57
|
-
var
|
|
58
|
-
var DcrTaskIcon_1 = __importDefault(require("../../../../../icons/DcrTaskIcon"));
|
|
59
|
-
var LineDecorator_1 = require("../../../LineDecorator");
|
|
60
|
-
var AttributesChanges_1 = require("../../../AttributesChanges");
|
|
69
|
+
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
|
|
61
70
|
var DataChangeRequestTaskCard_1 = require("./DataChangeRequestTaskCard");
|
|
62
|
-
jest.mock('
|
|
63
|
-
|
|
64
|
-
GenericWorkflowTaskCard: function (_a) {
|
|
65
|
-
var children = _a.children;
|
|
66
|
-
return react_1.default.createElement("div", null, children);
|
|
67
|
-
}
|
|
68
|
-
}); });
|
|
69
|
-
jest.mock('../../../AttributesChanges', function () { return ({
|
|
70
|
-
// eslint-disable-next-line
|
|
71
|
-
AttributesChanges: function (_a) {
|
|
72
|
-
var children = _a.children;
|
|
73
|
-
return react_1.default.createElement("div", null, children);
|
|
74
|
-
}
|
|
75
|
-
}); });
|
|
76
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getDataChangeRequest: jest.fn() })); });
|
|
71
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getDataChangeRequest: jest.fn(), getEntitiesByUris: jest.fn() })); });
|
|
72
|
+
jest.mock('../../../../../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../../../../../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn() })); });
|
|
77
73
|
describe('DataChangeRequestTaskCard tests', function () {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
var metadata = {
|
|
76
|
+
entityTypes: [
|
|
77
|
+
{
|
|
78
|
+
uri: 'configuration/entityTypes/Company',
|
|
79
|
+
label: 'Company',
|
|
80
|
+
description: 'Company',
|
|
81
|
+
extendsTypeURI: 'configuration/entityTypes/Organization',
|
|
82
|
+
attributes: [
|
|
83
|
+
{
|
|
84
|
+
label: 'Activation Date',
|
|
85
|
+
name: 'ActivationDate',
|
|
86
|
+
type: 'String',
|
|
87
|
+
uri: 'configuration/entityTypes/Company/attributes/ActivationDate'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: 'Name',
|
|
91
|
+
name: 'Name',
|
|
92
|
+
type: 'String',
|
|
93
|
+
uri: 'configuration/entityTypes/Company/attributes/Name'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
dependentLookupCode: 'COUNTRY_CD',
|
|
97
|
+
label: 'Country Code',
|
|
98
|
+
name: 'CountryCode',
|
|
99
|
+
type: 'String',
|
|
100
|
+
uri: 'configuration/entityTypes/Company/attributes/CountryCode'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: 'Address',
|
|
104
|
+
name: 'Address',
|
|
105
|
+
type: 'Reference',
|
|
106
|
+
uri: 'configuration/entityTypes/Company/attributes/Address',
|
|
107
|
+
referencedAttributeURIs: ['configuration/entityTypes/Location/attributes/City'],
|
|
108
|
+
referencedEntityTypeURI: 'configuration/entityTypes/Location'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: 'NestedFirstLevel',
|
|
112
|
+
name: 'NestedFirstLevel',
|
|
113
|
+
type: 'Nested',
|
|
114
|
+
uri: 'configuration/entityTypes/Company/attributes/NestedFirstLevel',
|
|
115
|
+
attributes: [
|
|
116
|
+
{
|
|
117
|
+
label: 'NestedSecondLevel',
|
|
118
|
+
name: 'NestedSecondLevel',
|
|
119
|
+
type: 'Nested',
|
|
120
|
+
uri: 'configuration/entityTypes/Company/attributes/NestedFirstLevel/attributes/NestedSecondLevel',
|
|
121
|
+
attributes: [
|
|
122
|
+
{
|
|
123
|
+
label: 'FifthLevelSimple4',
|
|
124
|
+
name: 'FifthLevelSimple4',
|
|
125
|
+
type: 'String',
|
|
126
|
+
uri: 'configuration/entityTypes/Company/attributes/NestedFirstLevel/attributes/NestedSecondLevel/attributes/FifthLevelSimple4'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: 'FifthLevelSimple5',
|
|
130
|
+
name: 'FifthLevelSimple5',
|
|
131
|
+
type: 'String',
|
|
132
|
+
uri: 'configuration/entityTypes/Company/attributes/NestedFirstLevel/attributes/NestedSecondLevel/attributes/FifthLevelSimple5'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
abstract: false
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
uri: 'configuration/entityTypes/Location',
|
|
143
|
+
label: 'Address',
|
|
144
|
+
attributes: [
|
|
145
|
+
{
|
|
146
|
+
label: 'City',
|
|
147
|
+
name: 'City',
|
|
148
|
+
type: 'String',
|
|
149
|
+
uri: 'configuration/entityTypes/Location/attributes/City'
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
abstract: false
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
relationTypes: [
|
|
156
|
+
{
|
|
157
|
+
uri: 'configuration/relationTypes/Managed',
|
|
158
|
+
label: 'Managed',
|
|
159
|
+
startObject: {
|
|
160
|
+
uri: 'configuration/relationTypes/Managed/startObject',
|
|
161
|
+
objectTypeURI: 'configuration/entityTypes/Company'
|
|
162
|
+
},
|
|
163
|
+
endObject: {
|
|
164
|
+
uri: 'configuration/relationTypes/Managed/endObject',
|
|
165
|
+
objectTypeURI: 'configuration/entityTypes/Company'
|
|
166
|
+
},
|
|
167
|
+
attributes: [],
|
|
168
|
+
direction: 'directed'
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
var entityUri = 'entities/00COBWl';
|
|
173
|
+
var relationUri = 'relations/07VxtSE';
|
|
174
|
+
var userName = 'eugeny.sokolov';
|
|
175
|
+
var priorityClass = 'Medium';
|
|
176
|
+
var displayName = 'DCR Review';
|
|
177
|
+
var processDefinitionDisplayName = 'Data Change Request Review';
|
|
178
|
+
var dcrId = '0kCnzFE';
|
|
179
|
+
var dcrUri = "changeRequests/".concat(dcrId);
|
|
180
|
+
var dueDate = 1731825314640;
|
|
181
|
+
var newStartDate = (0, moment_1.default)('11/15/2024', 'MM/DD/YYYY').valueOf();
|
|
78
182
|
var task = {
|
|
79
|
-
assignee:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
183
|
+
assignee: userName,
|
|
184
|
+
processInstanceId: '60260030',
|
|
185
|
+
processType: 'dataChangeRequestReview',
|
|
186
|
+
objectURIs: [dcrUri, entityUri, relationUri],
|
|
187
|
+
suspended: false,
|
|
188
|
+
createdBy: userName,
|
|
189
|
+
priorityClass: priorityClass,
|
|
190
|
+
taskType: 'dcrReview',
|
|
191
|
+
createTime: 1731652514639,
|
|
192
|
+
dueDate: dueDate,
|
|
193
|
+
taskId: '60260042',
|
|
194
|
+
displayName: displayName,
|
|
195
|
+
processDefinitionDisplayName: processDefinitionDisplayName
|
|
196
|
+
};
|
|
197
|
+
var entityLabel = 'EntityLabel';
|
|
198
|
+
var relationEntityLabel = 'RelationEntityLabel';
|
|
199
|
+
var refEntityLabel = 'RefEntityLabel';
|
|
200
|
+
var oldNameValue = 'oldNameValue';
|
|
201
|
+
var newNameValue = 'newNameValue';
|
|
202
|
+
var dcr = {
|
|
203
|
+
uri: 'changeRequests/0kCnzFE',
|
|
204
|
+
createdBy: userName,
|
|
205
|
+
createdTime: 1731652509123,
|
|
206
|
+
updatedBy: userName,
|
|
207
|
+
updatedTime: 1731652511713,
|
|
208
|
+
changes: (_a = {},
|
|
209
|
+
_a[entityUri] = [
|
|
210
|
+
{
|
|
211
|
+
id: '0kCo7lk',
|
|
212
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
|
|
213
|
+
createdTime: 1731652511713,
|
|
214
|
+
createdBy: userName,
|
|
215
|
+
attributePath: 'Name/xhGw4BJ',
|
|
216
|
+
oldValue: {
|
|
217
|
+
value: oldNameValue
|
|
218
|
+
},
|
|
219
|
+
newValue: {
|
|
220
|
+
value: newNameValue
|
|
221
|
+
},
|
|
222
|
+
attributeType: 'configuration/entityTypes/Company/attributes/Name'
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
_a[relationUri] = [
|
|
226
|
+
{
|
|
227
|
+
id: '0kCnuyy',
|
|
228
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_START_DATE,
|
|
229
|
+
createdTime: 1731652509123,
|
|
230
|
+
createdBy: userName,
|
|
231
|
+
newValue: [newStartDate]
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
_a),
|
|
235
|
+
objectsInfo: (_b = {},
|
|
236
|
+
_b[entityUri] = {
|
|
237
|
+
type: 'configuration/entityTypes/Company',
|
|
238
|
+
label: entityLabel
|
|
239
|
+
},
|
|
240
|
+
_b[relationUri] = {
|
|
241
|
+
type: 'configuration/relationTypes/Managed',
|
|
242
|
+
startObjectUri: 'entities/07AWt2z',
|
|
243
|
+
startObjectLabel: relationEntityLabel,
|
|
244
|
+
endObjectUri: entityUri,
|
|
245
|
+
endObjectLabel: entityLabel
|
|
246
|
+
},
|
|
247
|
+
_b['entities/19emZkLd'] = {
|
|
248
|
+
type: 'configuration/entityTypes/Location',
|
|
249
|
+
label: refEntityLabel
|
|
250
|
+
},
|
|
251
|
+
_b),
|
|
252
|
+
type: 'configuration/changeRequestTypes/default',
|
|
253
|
+
state: 'AWAITING_REVIEW'
|
|
254
|
+
};
|
|
255
|
+
var entities = [
|
|
256
|
+
{
|
|
257
|
+
uri: 'entities/07AWt2z',
|
|
258
|
+
type: 'configuration/entityTypes/Company',
|
|
259
|
+
label: relationEntityLabel
|
|
260
|
+
}
|
|
261
|
+
];
|
|
262
|
+
var setUp = function () {
|
|
263
|
+
var user = user_event_1.default.setup();
|
|
264
|
+
var Providers = function (_a) {
|
|
265
|
+
var children = _a.children;
|
|
266
|
+
return (react_1.default.createElement(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterMoment_1.AdapterMoment }, children));
|
|
267
|
+
};
|
|
268
|
+
return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(DataChangeRequestTaskCard_1.DataChangeRequestTaskCard, { task: task }), { wrapper: Providers })), { user: user });
|
|
89
269
|
};
|
|
90
|
-
var resolveGetDataChangeRequest;
|
|
91
270
|
beforeAll(function () {
|
|
92
|
-
mdm_sdk_1.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
});
|
|
271
|
+
mdm_sdk_1.getEntitiesByUris.mockResolvedValue(entities);
|
|
272
|
+
});
|
|
273
|
+
beforeEach(function () {
|
|
274
|
+
MdmModuleContext_1.useMdmMetadata.mockReturnValue(metadata);
|
|
97
275
|
});
|
|
98
276
|
afterEach(function () {
|
|
99
277
|
jest.clearAllMocks();
|
|
100
278
|
});
|
|
101
279
|
it('should render main parts', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
-
var
|
|
280
|
+
var user, changesContainers;
|
|
103
281
|
return __generator(this, function (_a) {
|
|
104
282
|
switch (_a.label) {
|
|
105
283
|
case 0:
|
|
106
|
-
dcr
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
expect(component.find(GenericWorkflowTaskCard_1.GenericWorkflowTaskCard).length).toBe(1);
|
|
116
|
-
expect(component.find(GenericWorkflowTaskCard_1.GenericWorkflowTaskCard).props()).toMatchObject({
|
|
117
|
-
task: task,
|
|
118
|
-
Icon: DcrTaskIcon_1.default
|
|
119
|
-
});
|
|
120
|
-
expect(component.find(GenericWorkflowTaskCard_1.GenericWorkflowTaskCard).length).toBe(1);
|
|
121
|
-
expect(component.find(LineDecorator_1.LineDecorator).length).toBe(0);
|
|
122
|
-
expect(component.find('AttributesChanges').length).toBe(0);
|
|
123
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
-
return __generator(this, function (_a) {
|
|
125
|
-
resolveGetDataChangeRequest(dcr);
|
|
126
|
-
return [2 /*return*/];
|
|
127
|
-
});
|
|
128
|
-
}); })];
|
|
284
|
+
mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcr);
|
|
285
|
+
user = setUp().user;
|
|
286
|
+
expect(react_2.screen.getByTestId('SvgDcrTaskIcon')).toBeInTheDocument();
|
|
287
|
+
expect(react_2.screen.getByText(processDefinitionDisplayName)).toBeInTheDocument();
|
|
288
|
+
expect(react_2.screen.getByText((0, moment_1.default)(dueDate).format('MM/DD/YYYY'))).toBeInTheDocument();
|
|
289
|
+
expect(react_2.screen.getByText(dcrId)).toBeInTheDocument();
|
|
290
|
+
expect(react_2.screen.getByText(userName)).toBeInTheDocument();
|
|
291
|
+
expect(react_2.screen.getByText(displayName)).toBeInTheDocument();
|
|
292
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('collapse-button'))];
|
|
129
293
|
case 1:
|
|
130
294
|
_a.sent();
|
|
131
|
-
|
|
132
|
-
expect(
|
|
133
|
-
expect(
|
|
134
|
-
expect(
|
|
135
|
-
expect(
|
|
136
|
-
expect(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
295
|
+
changesContainers = react_2.screen.getAllByTestId('changes-container');
|
|
296
|
+
expect(changesContainers).toHaveLength(2);
|
|
297
|
+
expect((0, react_2.within)(changesContainers[0]).getByText('Name')).toBeInTheDocument();
|
|
298
|
+
expect((0, react_2.within)(changesContainers[0]).getByText(entityLabel)).toBeInTheDocument();
|
|
299
|
+
expect((0, react_2.within)(changesContainers[0]).getByText(new RegExp("^".concat(oldNameValue, ".*").concat(newNameValue, "$")))).toBeInTheDocument();
|
|
300
|
+
expect((0, react_2.within)(changesContainers[0]).getByTestId('arrow-right')).toBeInTheDocument();
|
|
301
|
+
expect((0, react_2.within)(changesContainers[0]).getByText(mdm_sdk_1.DCROperationTypes.EDITED)).toBeInTheDocument();
|
|
302
|
+
expect((0, react_2.within)(changesContainers[1]).getByText(relationEntityLabel)).toBeInTheDocument();
|
|
303
|
+
expect((0, react_2.within)(changesContainers[1]).getByText('Relationships')).toBeInTheDocument();
|
|
304
|
+
expect((0, react_2.within)(changesContainers[1]).getByText('Managed')).toBeInTheDocument();
|
|
305
|
+
expect((0, react_2.within)(changesContainers[1]).getByText(entityLabel)).toBeInTheDocument();
|
|
306
|
+
expect((0, react_2.within)(changesContainers[1]).getByText('Start date')).toBeInTheDocument();
|
|
307
|
+
expect((0, react_2.within)(changesContainers[1]).getByText((0, moment_1.default)(newStartDate).format('MM/DD/YYYY'))).toBeInTheDocument();
|
|
308
|
+
expect((0, react_2.within)(changesContainers[1]).getByText(mdm_sdk_1.DCROperationTypes.ADDED)).toBeInTheDocument();
|
|
309
|
+
expect((0, react_2.within)(changesContainers[1]).queryByTestId('arrow-right')).not.toBeInTheDocument();
|
|
143
310
|
return [2 /*return*/];
|
|
144
311
|
}
|
|
145
312
|
});
|
|
146
313
|
}); });
|
|
147
|
-
it('should
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
314
|
+
it('should work correctly with nested attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
315
|
+
var nestedAttrName, subNestedAttrName, subSubNestedAttr1, addedNestedValue, changedWithNested, dcrWithNested, user;
|
|
316
|
+
var _a, _b;
|
|
317
|
+
return __generator(this, function (_c) {
|
|
318
|
+
switch (_c.label) {
|
|
151
319
|
case 0:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
320
|
+
nestedAttrName = 'NestedFirstLevel';
|
|
321
|
+
subNestedAttrName = 'NestedSecondLevel';
|
|
322
|
+
subSubNestedAttr1 = 'FifthLevelSimple4';
|
|
323
|
+
addedNestedValue = 'addedNestedValue';
|
|
324
|
+
changedWithNested = (_a = {},
|
|
325
|
+
_a[entityUri] = [
|
|
326
|
+
{
|
|
327
|
+
id: '0kCoGIG',
|
|
328
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
329
|
+
createdTime: 1731652511713,
|
|
330
|
+
createdBy: userName,
|
|
331
|
+
attributePath: nestedAttrName,
|
|
332
|
+
newValue: {
|
|
333
|
+
value: (_b = {},
|
|
334
|
+
_b[subNestedAttrName] = [
|
|
335
|
+
{
|
|
336
|
+
value: {
|
|
337
|
+
FifthLevelSimple4: [
|
|
338
|
+
{
|
|
339
|
+
value: addedNestedValue
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
_b)
|
|
346
|
+
},
|
|
347
|
+
attributeType: 'configuration/entityTypes/Company/attributes/NestedFirstLevel'
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
_a);
|
|
351
|
+
dcrWithNested = __assign(__assign({}, dcr), { changes: changedWithNested });
|
|
352
|
+
mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcrWithNested);
|
|
353
|
+
user = setUp().user;
|
|
354
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('collapse-button'))];
|
|
178
355
|
case 1:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
expect(
|
|
182
|
-
|
|
183
|
-
expect(
|
|
184
|
-
expect(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
356
|
+
_c.sent();
|
|
357
|
+
expect(react_2.screen.getByText(nestedAttrName)).toBeInTheDocument();
|
|
358
|
+
expect(react_2.screen.getByText(subNestedAttrName)).toBeInTheDocument();
|
|
359
|
+
expect(react_2.screen.getByText(subSubNestedAttr1)).toBeInTheDocument();
|
|
360
|
+
expect(react_2.screen.getByText(mdm_sdk_1.DCROperationTypes.ADDED)).toBeInTheDocument();
|
|
361
|
+
expect(react_2.screen.queryByTestId('arrow-right')).not.toBeInTheDocument();
|
|
362
|
+
return [2 /*return*/];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}); });
|
|
366
|
+
it('should work correctly with reference attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
367
|
+
var attributePath, refAttributeName, addedRefValue, changedWithRef, dcrWithRef, user;
|
|
368
|
+
var _a;
|
|
369
|
+
return __generator(this, function (_b) {
|
|
370
|
+
switch (_b.label) {
|
|
371
|
+
case 0:
|
|
372
|
+
attributePath = 'Address';
|
|
373
|
+
refAttributeName = 'City';
|
|
374
|
+
addedRefValue = 'addedRefValue';
|
|
375
|
+
changedWithRef = (_a = {},
|
|
376
|
+
_a[entityUri] = [
|
|
377
|
+
{
|
|
378
|
+
id: '0kCoC20',
|
|
379
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
380
|
+
createdTime: 1731652511713,
|
|
381
|
+
createdBy: 'eugeny.sokolov',
|
|
382
|
+
attributePath: attributePath,
|
|
383
|
+
newValue: {
|
|
384
|
+
value: {
|
|
385
|
+
City: [
|
|
386
|
+
{
|
|
387
|
+
value: addedRefValue
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
refEntity: {
|
|
392
|
+
objectURI: 'entities/19emZkLd'
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
attributeType: 'configuration/entityTypes/Company/attributes/Address'
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
_a);
|
|
399
|
+
dcrWithRef = __assign(__assign({}, dcr), { changes: changedWithRef });
|
|
400
|
+
mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcrWithRef);
|
|
401
|
+
user = setUp().user;
|
|
402
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('collapse-button'))];
|
|
403
|
+
case 1:
|
|
404
|
+
_b.sent();
|
|
405
|
+
expect(react_2.screen.getByText(attributePath)).toBeInTheDocument();
|
|
406
|
+
expect(react_2.screen.getByText(refAttributeName)).toBeInTheDocument();
|
|
407
|
+
expect(react_2.screen.getByText(refEntityLabel)).toBeInTheDocument();
|
|
408
|
+
expect(react_2.screen.getByText(addedRefValue)).toBeInTheDocument();
|
|
409
|
+
expect(react_2.screen.getByText(mdm_sdk_1.DCROperationTypes.ADDED)).toBeInTheDocument();
|
|
410
|
+
expect(react_2.screen.queryByTestId('arrow-right')).not.toBeInTheDocument();
|
|
411
|
+
return [2 /*return*/];
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}); });
|
|
415
|
+
it('should render ShowMoreLink if length of merged changes more than 3', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
416
|
+
var bigChanges, dcrWithBigChanges, user;
|
|
417
|
+
var _a;
|
|
418
|
+
return __generator(this, function (_b) {
|
|
419
|
+
switch (_b.label) {
|
|
420
|
+
case 0:
|
|
421
|
+
bigChanges = (_a = {},
|
|
422
|
+
_a[entityUri] = __spreadArray(__spreadArray([], dcr.changes[entityUri], true), [
|
|
423
|
+
{
|
|
424
|
+
attributePath: 'CountryCode',
|
|
425
|
+
attributeType: 'configuration/entityTypes/Company/attributes/CountryCode',
|
|
426
|
+
id: '41cb3c0i',
|
|
427
|
+
newValue: { value: 'Bahamas', lookupCode: 'BS', lookupRawValue: 'BS', pin: true },
|
|
428
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
attributePath: 'ActivationDate',
|
|
432
|
+
attributeType: 'configuration/entityTypes/Company/attributes/ActivationDate',
|
|
433
|
+
id: '41cb3t3k',
|
|
434
|
+
newValue: { value: '12.10.2011' },
|
|
435
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
attributePath: 'CountryCode/3AqlrpfGa',
|
|
439
|
+
attributeType: 'configuration/entityTypes/Company/attributes/CountryCode',
|
|
440
|
+
id: '41cb3gGy',
|
|
441
|
+
newValue: { value: 'Chile', lookupCode: 'CL', lookupRawValue: 'Chile', pin: true },
|
|
442
|
+
oldValue: { value: 'Chile', lookupCode: 'CL', lookupRawValue: 'Chile', pin: true },
|
|
443
|
+
type: mdm_sdk_1.DCRTypes.IGNORE_ATTRIBUTE
|
|
444
|
+
}
|
|
445
|
+
], false),
|
|
446
|
+
_a);
|
|
447
|
+
dcrWithBigChanges = __assign(__assign({}, dcr), { changes: bigChanges });
|
|
448
|
+
mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcrWithBigChanges);
|
|
449
|
+
user = setUp().user;
|
|
450
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('collapse-button'))];
|
|
451
|
+
case 1:
|
|
452
|
+
_b.sent();
|
|
453
|
+
expect(react_2.screen.getByText('Country Code')).toBeInTheDocument();
|
|
454
|
+
expect(react_2.screen.getByText('Bahamas (BS)')).toBeInTheDocument();
|
|
455
|
+
expect(react_2.screen.getByText('Activation Date')).toBeInTheDocument();
|
|
456
|
+
expect(react_2.screen.getByText('12.10.2011')).toBeInTheDocument();
|
|
457
|
+
expect(react_2.screen.getByText('Name')).toBeInTheDocument();
|
|
458
|
+
expect(react_2.screen.queryByText('Chile (CL)')).not.toBeInTheDocument();
|
|
459
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('View 1 more suggestions'))];
|
|
460
|
+
case 2:
|
|
461
|
+
_b.sent();
|
|
462
|
+
expect(react_2.screen.getByText('Chile (CL)')).toBeInTheDocument();
|
|
463
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('View less suggestions'))];
|
|
464
|
+
case 3:
|
|
465
|
+
_b.sent();
|
|
466
|
+
expect(react_2.screen.queryByText('Chile (CL)')).not.toBeInTheDocument();
|
|
467
|
+
return [2 /*return*/];
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}); });
|
|
471
|
+
it('should create correct link for new entity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
472
|
+
var changesWithNewEntity, dcrWithNewEntity, user, linkElement, href;
|
|
473
|
+
var _a;
|
|
474
|
+
return __generator(this, function (_b) {
|
|
475
|
+
switch (_b.label) {
|
|
476
|
+
case 0:
|
|
477
|
+
changesWithNewEntity = (_a = {},
|
|
478
|
+
_a[entityUri] = [
|
|
479
|
+
{
|
|
480
|
+
id: '3aMaA7ds',
|
|
481
|
+
type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
|
|
482
|
+
createdBy: 'alan.khugaev',
|
|
483
|
+
newValue: {
|
|
484
|
+
uri: 'entities/1WNHTsJw',
|
|
485
|
+
type: 'configuration/entityTypes/HCA',
|
|
486
|
+
attributes: {
|
|
487
|
+
CountryCode: [
|
|
488
|
+
{
|
|
489
|
+
value: 'Germany',
|
|
490
|
+
lookupCode: 'DE',
|
|
491
|
+
lookupRawValue: 'DE'
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
ActivationDate: [
|
|
495
|
+
{
|
|
496
|
+
value: '12.10.2011'
|
|
497
|
+
}
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
isFavorite: false
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
_a);
|
|
505
|
+
dcrWithNewEntity = __assign(__assign({}, dcr), { changes: changesWithNewEntity });
|
|
506
|
+
mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcrWithNewEntity);
|
|
507
|
+
user = setUp().user;
|
|
508
|
+
return [4 /*yield*/, user.click(react_2.screen.getByTestId('collapse-button'))];
|
|
509
|
+
case 1:
|
|
510
|
+
_b.sent();
|
|
511
|
+
linkElement = react_2.screen.getByRole('link');
|
|
512
|
+
href = linkElement.getAttribute('href');
|
|
513
|
+
expect(href).toMatch(new RegExp("".concat(dcrUri, "/changes/").concat(entityUri, "$")));
|
|
200
514
|
return [2 /*return*/];
|
|
201
515
|
}
|
|
202
516
|
});
|