@reltio/components 1.4.2026 → 1.4.2028
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/RCTree/styles.js +4 -1
- package/cjs/RCTree/styles.js +4 -1
- 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/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/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/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/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
package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var ChangeView_1 = require("../ChangeView");
|
|
20
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
21
|
-
var DataTypeValue_1 = require("../../../../../DataTypeValue");
|
|
22
|
-
var EntityUriLink_1 = require("../../../../../EntityUriLink");
|
|
23
|
-
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
|
|
24
|
-
var AttributesChangesContext_1 = require("../../AttributesChangesContext");
|
|
25
|
-
var DiffRenderer_1 = require("./DiffRenderer");
|
|
26
|
-
jest.mock('../../../../../EntityUriLink', function () { return ({
|
|
27
|
-
EntityUriLink: function (_a) {
|
|
28
|
-
var children = _a.children;
|
|
29
|
-
return react_1.default.createElement("div", null, children);
|
|
30
|
-
}
|
|
31
|
-
}); });
|
|
32
|
-
jest.mock('../../../../../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../../../../../contexts/MdmModuleContext')), { useMdmEntityUri: jest.fn() })); });
|
|
33
|
-
describe('DiffRenderer tests', function () {
|
|
34
|
-
beforeEach(function () {
|
|
35
|
-
MdmModuleContext_1.useMdmEntityUri.mockReturnValue('entities/1hRTSKE5');
|
|
36
|
-
});
|
|
37
|
-
it('should render ChangeView with props for change', function () {
|
|
38
|
-
var props = {
|
|
39
|
-
level: 0,
|
|
40
|
-
label: 'Customer Type',
|
|
41
|
-
attributeType: {
|
|
42
|
-
label: 'Customer Type',
|
|
43
|
-
name: 'TypeCode',
|
|
44
|
-
type: 'String',
|
|
45
|
-
uri: 'configuration/entityTypes/HCA/attributes/TypeCode',
|
|
46
|
-
dependentLookupCode: 'HCA_TYP_CD'
|
|
47
|
-
},
|
|
48
|
-
oldValue: {
|
|
49
|
-
lookupCode: 'ACIN',
|
|
50
|
-
lookupRawValue: 'ACIN',
|
|
51
|
-
value: 'academic institution'
|
|
52
|
-
},
|
|
53
|
-
newValue: {
|
|
54
|
-
lookupCode: 'BUOR',
|
|
55
|
-
lookupRawValue: 'BUOR',
|
|
56
|
-
value: 'buying organisation'
|
|
57
|
-
},
|
|
58
|
-
operation: mdm_sdk_1.DCROperationTypes.EDITED
|
|
59
|
-
};
|
|
60
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(DiffRenderer_1.DiffRenderer, __assign({}, props)));
|
|
61
|
-
var changeView = component.find(ChangeView_1.ChangeView);
|
|
62
|
-
expect(changeView).toHaveLength(1);
|
|
63
|
-
expect(new enzyme_1.ReactWrapper(changeView.prop('label')).text()).toBe(props.label);
|
|
64
|
-
var oldValue = new enzyme_1.ReactWrapper(changeView.prop('oldValue'));
|
|
65
|
-
expect(oldValue.find(DataTypeValue_1.DataTypeValue)).toHaveLength(1);
|
|
66
|
-
expect(oldValue.find(DataTypeValue_1.DataTypeValue).text()).toBe("".concat(props.oldValue.value, " (").concat(props.oldValue.lookupCode, ")"));
|
|
67
|
-
var newValue = new enzyme_1.ReactWrapper(changeView.prop('newValue'));
|
|
68
|
-
expect(newValue.find(DataTypeValue_1.DataTypeValue)).toHaveLength(1);
|
|
69
|
-
expect(newValue.find(DataTypeValue_1.DataTypeValue).text()).toBe("".concat(props.newValue.value, " (").concat(props.newValue.lookupCode, ")"));
|
|
70
|
-
expect(changeView.prop('operation')).toBe(props.operation);
|
|
71
|
-
});
|
|
72
|
-
it('should render label for Nested attribute', function () {
|
|
73
|
-
var props = {
|
|
74
|
-
level: 1,
|
|
75
|
-
label: 'Additional Attributes',
|
|
76
|
-
attributeType: {
|
|
77
|
-
label: 'Additional Attributes',
|
|
78
|
-
name: 'AdditionalAttributes',
|
|
79
|
-
type: 'Nested',
|
|
80
|
-
uri: 'configuration/relationTypes/HasAddress/attributes/AdditionalAttributes'
|
|
81
|
-
},
|
|
82
|
-
attributeValue: {
|
|
83
|
-
id: 'uri$$1643529639079',
|
|
84
|
-
value: {
|
|
85
|
-
id: '58dpOzAR',
|
|
86
|
-
attributePath: 'AdditionalAttributes',
|
|
87
|
-
attributeType: 'configuration/relationTypes/HasAddress/attributes/AdditionalAttributes',
|
|
88
|
-
newValue: {
|
|
89
|
-
value: {
|
|
90
|
-
AttributeType: [{ value: 'testType' }],
|
|
91
|
-
AttributeValue: [{ value: 'testValue' }]
|
|
92
|
-
},
|
|
93
|
-
refAttributeType: 'configuration/entityTypes/HCA/attributes/Address/attributes/AdditionalAttributes',
|
|
94
|
-
refObjectURI: 'relations/138xt4Lu',
|
|
95
|
-
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(DiffRenderer_1.DiffRenderer, __assign({}, props)));
|
|
101
|
-
var changeView = component.find(ChangeView_1.ChangeView);
|
|
102
|
-
expect(changeView).toHaveLength(1);
|
|
103
|
-
expect(new enzyme_1.ReactWrapper(changeView.prop('label')).text()).toBe(props.label);
|
|
104
|
-
expect(changeView.prop('oldValue')).toBeUndefined();
|
|
105
|
-
expect(changeView.prop('newValue')).toBeUndefined();
|
|
106
|
-
expect(changeView.prop('operation')).toBeUndefined();
|
|
107
|
-
});
|
|
108
|
-
it('should render label for new Reference attribute', function () {
|
|
109
|
-
var _a;
|
|
110
|
-
var entityUri = 'entities/1dmAvgmV';
|
|
111
|
-
var props = {
|
|
112
|
-
level: 0,
|
|
113
|
-
label: 'Address',
|
|
114
|
-
attributeType: {
|
|
115
|
-
label: 'Address',
|
|
116
|
-
name: 'Address',
|
|
117
|
-
referencedEntityTypeURI: 'configuration/entityTypes/Location',
|
|
118
|
-
type: 'Reference',
|
|
119
|
-
uri: 'configuration/entityTypes/HCA/attributes/Address'
|
|
120
|
-
},
|
|
121
|
-
attributeValue: {
|
|
122
|
-
id: 'uri$$1643535595616',
|
|
123
|
-
value: {
|
|
124
|
-
id: '4jHUANlF',
|
|
125
|
-
attributePath: 'Address',
|
|
126
|
-
attributeType: 'configuration/entityTypes/HCA/attributes/Address',
|
|
127
|
-
newValue: {
|
|
128
|
-
refEntity: { objectURI: entityUri },
|
|
129
|
-
value: {
|
|
130
|
-
AddressType: [{ value: '' }]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var objectsInfo = (_a = {},
|
|
137
|
-
_a[entityUri] = {
|
|
138
|
-
isExist: true,
|
|
139
|
-
label: 'Santa Clara',
|
|
140
|
-
secondaryLabel: '',
|
|
141
|
-
type: 'configuration/entityTypes/Location'
|
|
142
|
-
},
|
|
143
|
-
_a['entities/1hRTSKE5'] = {
|
|
144
|
-
isExist: true,
|
|
145
|
-
label: '12345 - Address Line 1 City',
|
|
146
|
-
secondaryLabel: '12345',
|
|
147
|
-
type: 'configuration/entityTypes/HCA'
|
|
148
|
-
},
|
|
149
|
-
_a);
|
|
150
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(AttributesChangesContext_1.AttributesChangesContext.Provider, { value: objectsInfo },
|
|
151
|
-
react_1.default.createElement(DiffRenderer_1.DiffRenderer, __assign({}, props))));
|
|
152
|
-
var changeView = component.find(ChangeView_1.ChangeView);
|
|
153
|
-
expect(changeView).toHaveLength(1);
|
|
154
|
-
var label = new enzyme_1.ReactWrapper(changeView.prop('label'));
|
|
155
|
-
expect(label.text()).toBe("".concat(props.label).concat(objectsInfo[entityUri].label));
|
|
156
|
-
expect(label.find(EntityUriLink_1.EntityUriLink).prop('value')).toBe(entityUri);
|
|
157
|
-
expect(changeView.prop('oldValue')).toBeUndefined();
|
|
158
|
-
expect(changeView.prop('newValue')).toBeUndefined();
|
|
159
|
-
expect(changeView.prop('operation')).toBeUndefined();
|
|
160
|
-
});
|
|
161
|
-
it('should render label for existing Reference attribute', function () {
|
|
162
|
-
var _a;
|
|
163
|
-
var entityUri = 'entities/1hRTSKE5';
|
|
164
|
-
var relationUri = 'relations/YduMTVk';
|
|
165
|
-
var props = {
|
|
166
|
-
level: 0,
|
|
167
|
-
label: 'Address',
|
|
168
|
-
attributeType: {
|
|
169
|
-
label: 'Address',
|
|
170
|
-
name: 'Address',
|
|
171
|
-
referencedEntityTypeURI: 'configuration/entityTypes/Location',
|
|
172
|
-
type: 'Reference',
|
|
173
|
-
uri: 'configuration/entityTypes/HCA/attributes/Address'
|
|
174
|
-
},
|
|
175
|
-
attributeValue: {
|
|
176
|
-
id: 'YduMTVk',
|
|
177
|
-
refObjectURI: relationUri,
|
|
178
|
-
value: {
|
|
179
|
-
Phone: [
|
|
180
|
-
{
|
|
181
|
-
id: 'uri$$1643534611142',
|
|
182
|
-
value: {
|
|
183
|
-
id: 'Apethebi',
|
|
184
|
-
newValue: { value: { Active: [{ value: 'false' }] } }
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
var objectsInfo = (_a = {},
|
|
192
|
-
_a[entityUri] = {
|
|
193
|
-
isExist: true,
|
|
194
|
-
label: '12345 - Address Line 1 City',
|
|
195
|
-
secondaryLabel: '12345',
|
|
196
|
-
type: 'configuration/entityTypes/HCA'
|
|
197
|
-
},
|
|
198
|
-
_a[relationUri] = {
|
|
199
|
-
endObjectLabel: 'Address Line 1 City Zip6',
|
|
200
|
-
endObjectUri: 'entities/brJPdnD',
|
|
201
|
-
isExist: true,
|
|
202
|
-
startObjectLabel: '12345 - Address Line 1 City',
|
|
203
|
-
startObjectUri: entityUri,
|
|
204
|
-
type: 'configuration/relationTypes/HasAddress'
|
|
205
|
-
},
|
|
206
|
-
_a);
|
|
207
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(AttributesChangesContext_1.AttributesChangesContext.Provider, { value: objectsInfo },
|
|
208
|
-
react_1.default.createElement(DiffRenderer_1.DiffRenderer, __assign({}, props))));
|
|
209
|
-
var changeView = component.find(ChangeView_1.ChangeView);
|
|
210
|
-
expect(changeView).toHaveLength(1);
|
|
211
|
-
var label = new enzyme_1.ReactWrapper(changeView.prop('label'));
|
|
212
|
-
expect(label.text()).toBe("".concat(props.label).concat(objectsInfo[relationUri].endObjectLabel));
|
|
213
|
-
expect(label.find(EntityUriLink_1.EntityUriLink).prop('value')).toBe(objectsInfo[relationUri].endObjectUri);
|
|
214
|
-
expect(changeView.prop('oldValue')).toBeUndefined();
|
|
215
|
-
expect(changeView.prop('newValue')).toBeUndefined();
|
|
216
|
-
expect(changeView.prop('operation')).toBeUndefined();
|
|
217
|
-
});
|
|
218
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import { shallow } from 'enzyme';
|
|
23
|
-
import { DCRTypes } from '@reltio/mdm-sdk';
|
|
24
|
-
import { act } from 'react-dom/test-utils';
|
|
25
|
-
import { useMdmMetadata } from '../../../contexts/MdmModuleContext';
|
|
26
|
-
import { EntityUriLink } from '../../../EntityUriLink';
|
|
27
|
-
import { DCRChangesList } from './components/DCRChangesList';
|
|
28
|
-
import { ShowMoreLink } from './components/ShowMoreLink';
|
|
29
|
-
import { AttributesChangesContext } from './AttributesChangesContext';
|
|
30
|
-
import { AttributesChanges } from './AttributesChanges';
|
|
31
|
-
jest.mock('../../../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../../../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn() })); });
|
|
32
|
-
var metadata = {
|
|
33
|
-
entityTypes: [
|
|
34
|
-
{
|
|
35
|
-
uri: 'configuration/entityTypes/HCA',
|
|
36
|
-
label: 'HCA label',
|
|
37
|
-
attributes: [
|
|
38
|
-
{
|
|
39
|
-
label: 'Activation Date',
|
|
40
|
-
name: 'ActivationDate',
|
|
41
|
-
type: 'String',
|
|
42
|
-
uri: 'configuration/entityTypes/HCA/attributes/ActivationDate'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
dependentLookupCode: 'COUNTRY_CD',
|
|
46
|
-
label: 'Country Code',
|
|
47
|
-
name: 'CountryCode',
|
|
48
|
-
type: 'String',
|
|
49
|
-
uri: 'configuration/entityTypes/HCA/attributes/CountryCode'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
dependentLookupCode: 'HCA_TYP_CD',
|
|
53
|
-
label: 'Customer Type',
|
|
54
|
-
name: 'TypeCode',
|
|
55
|
-
type: 'String',
|
|
56
|
-
uri: 'configuration/entityTypes/HCA/attributes/TypeCode'
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
};
|
|
62
|
-
describe('AttributesChanges tests', function () {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
beforeEach(function () {
|
|
65
|
-
useMdmMetadata.mockReturnValue(metadata);
|
|
66
|
-
});
|
|
67
|
-
var entityUri = 'entities/1hRTSKE5';
|
|
68
|
-
var dcrUri = 'changeRequests/3aMaA3Nc';
|
|
69
|
-
var changes = (_a = {},
|
|
70
|
-
_a[entityUri] = [
|
|
71
|
-
{
|
|
72
|
-
attributePath: 'ActivationDate',
|
|
73
|
-
attributeType: 'configuration/entityTypes/HCA/attributes/ActivationDate',
|
|
74
|
-
id: '41cb3t3k',
|
|
75
|
-
newValue: { value: '12.10.2011' },
|
|
76
|
-
type: DCRTypes.INSERT_ATTRIBUTE
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
attributePath: 'CountryCode/3AqlrpfGa',
|
|
80
|
-
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
81
|
-
id: '41cb3gGy',
|
|
82
|
-
newValue: { value: 'Chile', lookupCode: 'CL', lookupRawValue: 'Chile', pin: true },
|
|
83
|
-
oldValue: { value: 'Chile', lookupCode: 'CL', lookupRawValue: 'Chile', pin: true },
|
|
84
|
-
type: DCRTypes.IGNORE_ATTRIBUTE
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
attributePath: 'TypeCode/45uyph6Aj',
|
|
88
|
-
attributeType: 'configuration/entityTypes/HCA/attributes/TypeCode',
|
|
89
|
-
id: '41cb3kXE',
|
|
90
|
-
newValue: { value: 'academic institution', lookupCode: 'ACIN', lookupRawValue: 'ACIN', pin: true },
|
|
91
|
-
oldValue: { value: 'academic institution', lookupCode: 'ACIN', lookupRawValue: 'ACIN', pin: true },
|
|
92
|
-
type: DCRTypes.DELETE_ATTRIBUTE
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
_a);
|
|
96
|
-
var entityInfo = {
|
|
97
|
-
isExist: true,
|
|
98
|
-
label: '12345 - Address Line 1 City',
|
|
99
|
-
secondaryLabel: '12345',
|
|
100
|
-
type: 'configuration/entityTypes/HCA',
|
|
101
|
-
uri: entityUri
|
|
102
|
-
};
|
|
103
|
-
var objectsInfo = (_b = {},
|
|
104
|
-
_b[entityUri] = entityInfo,
|
|
105
|
-
_b);
|
|
106
|
-
it('should render main parts with props', function () {
|
|
107
|
-
var expectedChanges = [
|
|
108
|
-
{
|
|
109
|
-
attributeType: metadata.entityTypes[0].attributes[0],
|
|
110
|
-
label: 'Activation Date',
|
|
111
|
-
level: 0,
|
|
112
|
-
newValue: {
|
|
113
|
-
value: '12.10.2011'
|
|
114
|
-
},
|
|
115
|
-
operation: 'added'
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
attributeType: metadata.entityTypes[0].attributes[1],
|
|
119
|
-
label: 'Country Code',
|
|
120
|
-
level: 0,
|
|
121
|
-
newValue: {
|
|
122
|
-
lookupCode: 'CL',
|
|
123
|
-
lookupRawValue: 'Chile',
|
|
124
|
-
pin: true,
|
|
125
|
-
value: 'Chile'
|
|
126
|
-
},
|
|
127
|
-
operation: 'ignored'
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
attributeType: metadata.entityTypes[0].attributes[2],
|
|
131
|
-
label: 'Customer Type',
|
|
132
|
-
level: 0,
|
|
133
|
-
newValue: {
|
|
134
|
-
lookupCode: 'ACIN',
|
|
135
|
-
lookupRawValue: 'ACIN',
|
|
136
|
-
pin: true,
|
|
137
|
-
value: 'academic institution'
|
|
138
|
-
},
|
|
139
|
-
operation: 'deleted'
|
|
140
|
-
}
|
|
141
|
-
];
|
|
142
|
-
var component = shallow(React.createElement(AttributesChanges, { entityInfo: entityInfo, relationsInfo: [], changes: changes, objectsInfo: objectsInfo, dcrUri: dcrUri }));
|
|
143
|
-
var context = component.find(AttributesChangesContext.Provider);
|
|
144
|
-
expect(context).toHaveLength(1);
|
|
145
|
-
expect(context.prop('value')).toEqual(objectsInfo);
|
|
146
|
-
var entityLink = component.find(EntityUriLink);
|
|
147
|
-
expect(entityLink).toHaveLength(1);
|
|
148
|
-
expect(entityLink.prop('value')).toBe(entityInfo.uri);
|
|
149
|
-
expect(entityLink.text()).toBe(entityInfo.label);
|
|
150
|
-
var dcrList = component.find(DCRChangesList);
|
|
151
|
-
expect(dcrList).toHaveLength(1);
|
|
152
|
-
expect(dcrList.props()).toEqual({
|
|
153
|
-
changes: expectedChanges
|
|
154
|
-
});
|
|
155
|
-
expect(component.find(ShowMoreLink)).toHaveLength(0);
|
|
156
|
-
});
|
|
157
|
-
it('should render ShowMoreLink if length of merged changes more than 3', function () {
|
|
158
|
-
var _a;
|
|
159
|
-
var bigChanges = (_a = {},
|
|
160
|
-
_a[entityUri] = __spreadArray(__spreadArray([], changes[entityUri], true), [
|
|
161
|
-
{
|
|
162
|
-
attributePath: 'CountryCode',
|
|
163
|
-
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
164
|
-
id: '41cb3c0i',
|
|
165
|
-
newValue: { value: 'Bahamas', lookupCode: 'BS', lookupRawValue: 'BS' },
|
|
166
|
-
type: DCRTypes.INSERT_ATTRIBUTE
|
|
167
|
-
}
|
|
168
|
-
], false),
|
|
169
|
-
_a);
|
|
170
|
-
var component = shallow(React.createElement(AttributesChanges, { entityInfo: entityInfo, relationsInfo: [], changes: bigChanges, objectsInfo: objectsInfo, dcrUri: dcrUri }));
|
|
171
|
-
var entityLink = component.find(EntityUriLink);
|
|
172
|
-
expect(entityLink).toHaveLength(1);
|
|
173
|
-
expect(entityLink.prop('value')).toBe(entityInfo.uri);
|
|
174
|
-
expect(entityLink.text()).toBe(entityInfo.label);
|
|
175
|
-
var dcrList = component.find(DCRChangesList);
|
|
176
|
-
expect(dcrList).toHaveLength(1);
|
|
177
|
-
expect(dcrList.prop('changes').length).toBe(3);
|
|
178
|
-
var showMoreLink = component.find(ShowMoreLink);
|
|
179
|
-
expect(showMoreLink).toHaveLength(1);
|
|
180
|
-
expect(showMoreLink.props()).toEqual({
|
|
181
|
-
onClick: expect.any(Function),
|
|
182
|
-
suggestionsCount: 1,
|
|
183
|
-
isExpanded: false,
|
|
184
|
-
className: 'showMoreLink'
|
|
185
|
-
});
|
|
186
|
-
act(function () {
|
|
187
|
-
showMoreLink.prop('onClick')();
|
|
188
|
-
});
|
|
189
|
-
component.update();
|
|
190
|
-
expect(component.find(DCRChangesList).prop('changes').length).toBe(4);
|
|
191
|
-
expect(component.find(ShowMoreLink).props()).toEqual({
|
|
192
|
-
onClick: expect.any(Function),
|
|
193
|
-
suggestionsCount: 1,
|
|
194
|
-
isExpanded: true,
|
|
195
|
-
className: 'showMoreLink'
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
it('should render empty DCRChangesList when changes are empty', function () {
|
|
199
|
-
var component = shallow(React.createElement(AttributesChanges, { entityInfo: entityInfo, relationsInfo: [], changes: {}, objectsInfo: {}, dcrUri: dcrUri }));
|
|
200
|
-
var entityLink = component.find(EntityUriLink);
|
|
201
|
-
expect(entityLink).toHaveLength(1);
|
|
202
|
-
expect(entityLink.prop('value')).toBe(entityInfo.uri);
|
|
203
|
-
expect(entityLink.text()).toBe(entityInfo.label);
|
|
204
|
-
var dcrList = component.find(DCRChangesList);
|
|
205
|
-
expect(dcrList).toHaveLength(1);
|
|
206
|
-
expect(dcrList.prop('changes').length).toBe(0);
|
|
207
|
-
expect(component.find(ShowMoreLink)).toHaveLength(0);
|
|
208
|
-
});
|
|
209
|
-
it('should create correct link for new entity', function () {
|
|
210
|
-
var _a;
|
|
211
|
-
var changesWithNewEntity = (_a = {},
|
|
212
|
-
_a[entityUri] = [
|
|
213
|
-
{
|
|
214
|
-
id: '3aMaA7ds',
|
|
215
|
-
type: DCRTypes.CREATE_ENTITY,
|
|
216
|
-
createdBy: 'alan.khugaev',
|
|
217
|
-
newValue: {
|
|
218
|
-
uri: 'entities/1WNHTsJw',
|
|
219
|
-
type: 'configuration/entityTypes/HCA',
|
|
220
|
-
attributes: {
|
|
221
|
-
CountryCode: [
|
|
222
|
-
{
|
|
223
|
-
value: 'Germany',
|
|
224
|
-
lookupCode: 'DE',
|
|
225
|
-
lookupRawValue: 'DE'
|
|
226
|
-
}
|
|
227
|
-
],
|
|
228
|
-
ActivationDate: [
|
|
229
|
-
{
|
|
230
|
-
value: '12.10.2011'
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
},
|
|
234
|
-
isFavorite: false
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
],
|
|
238
|
-
_a);
|
|
239
|
-
var component = shallow(React.createElement(AttributesChanges, { entityInfo: entityInfo, relationsInfo: [], changes: changesWithNewEntity, objectsInfo: objectsInfo, dcrUri: dcrUri }));
|
|
240
|
-
var entityLink = component.find(EntityUriLink);
|
|
241
|
-
expect(entityLink.prop('value')).toBe("".concat(dcrUri, "/changes/").concat(entityUri));
|
|
242
|
-
expect(entityLink.prop('screen')).toBe('dcrReview');
|
|
243
|
-
});
|
|
244
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt';
|
|
4
|
-
import Chip from '@mui/material/Chip';
|
|
5
|
-
import { DCROperationTypes } from '@reltio/mdm-sdk';
|
|
6
|
-
import { ChangeView } from './ChangeView';
|
|
7
|
-
describe('ChangeView tests', function () {
|
|
8
|
-
it('should render only label when other props are not set', function () {
|
|
9
|
-
var label = 'Test label';
|
|
10
|
-
var component = shallow(React.createElement(ChangeView, { label: label }));
|
|
11
|
-
expect(component.text()).toBe("".concat(label, ":"));
|
|
12
|
-
expect(component.find('.difference')).toHaveLength(0);
|
|
13
|
-
expect(component.find(ArrowRightAltIcon)).toHaveLength(0);
|
|
14
|
-
expect(component.find(Chip)).toHaveLength(0);
|
|
15
|
-
});
|
|
16
|
-
it('should render label, one value and Chip id other value is not set', function () {
|
|
17
|
-
var label = 'Test label';
|
|
18
|
-
var newValue = 'value';
|
|
19
|
-
var operation = DCROperationTypes.ADDED;
|
|
20
|
-
var component = shallow(React.createElement(ChangeView, { label: label, newValue: newValue, operation: operation }));
|
|
21
|
-
expect(component.text()).toBe("".concat(label, ":").concat(newValue));
|
|
22
|
-
expect(component.find(ArrowRightAltIcon)).toHaveLength(0);
|
|
23
|
-
var chip = component.find(Chip);
|
|
24
|
-
expect(chip).toHaveLength(1);
|
|
25
|
-
expect(chip.prop('label')).toBe('added');
|
|
26
|
-
});
|
|
27
|
-
it('should render all parts', function () {
|
|
28
|
-
var label = 'Test label';
|
|
29
|
-
var newValue = 'value1';
|
|
30
|
-
var oldValue = 'value2';
|
|
31
|
-
var operation = DCROperationTypes.EDITED;
|
|
32
|
-
var component = shallow(React.createElement(ChangeView, { label: label, newValue: newValue, oldValue: oldValue, operation: operation }));
|
|
33
|
-
expect(component.text()).toBe("".concat(label, ":").concat(oldValue).concat(newValue));
|
|
34
|
-
expect(component.find(ArrowRightAltIcon)).toHaveLength(1);
|
|
35
|
-
var chip = component.find(Chip);
|
|
36
|
-
expect(chip).toHaveLength(1);
|
|
37
|
-
expect(chip.prop('label')).toBe('edited');
|
|
38
|
-
});
|
|
39
|
-
});
|
package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import { DataTypes } from '@reltio/mdm-sdk';
|
|
4
|
-
import { DiffRenderer } from '../DiffRenderer';
|
|
5
|
-
import { DCRChangesList } from './DCRChangesList';
|
|
6
|
-
describe('DCRChangesList tests', function () {
|
|
7
|
-
it('should provide changes props to DiffRenderer', function () {
|
|
8
|
-
var changes = [
|
|
9
|
-
{ level: 0, label: 'Label 1', attributeType: { type: DataTypes.TYPE_STRING, name: 'name1', uri: 'uri1' } },
|
|
10
|
-
{ level: 1, label: 'Label 2', attributeType: { type: DataTypes.TYPE_STRING, name: 'name2', uri: 'uri2' } },
|
|
11
|
-
{ level: 2, label: 'Label 3', attributeType: { type: DataTypes.TYPE_STRING, name: 'name3', uri: 'uri3' } }
|
|
12
|
-
];
|
|
13
|
-
var component = shallow(React.createElement(DCRChangesList, { changes: changes }));
|
|
14
|
-
var diffs = component.find(DiffRenderer);
|
|
15
|
-
expect(diffs).toHaveLength(changes.length);
|
|
16
|
-
diffs.map(function (diff, index) {
|
|
17
|
-
expect(diff.props()).toEqual(changes[index]);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
it('should render Relationships title', function () {
|
|
21
|
-
var changes = [
|
|
22
|
-
{ level: 0, label: 'Label 1', attributeType: { type: DataTypes.TYPE_STRING, name: 'name1', uri: 'uri1' } },
|
|
23
|
-
{ level: 1, label: 'Label 2', attributeType: { type: DataTypes.TYPE_STRING, name: 'name2', uri: 'uri2' } },
|
|
24
|
-
{ label: 'Relationships' }
|
|
25
|
-
];
|
|
26
|
-
var component = shallow(React.createElement(DCRChangesList, { changes: changes }));
|
|
27
|
-
var diffs = component.find(DiffRenderer);
|
|
28
|
-
expect(diffs).toHaveLength(changes.length - 1);
|
|
29
|
-
var title = component.find('.title');
|
|
30
|
-
expect(title).toHaveLength(1);
|
|
31
|
-
expect(title.text()).toBe('Relationships');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|