@reltio/components 1.4.1906 → 1.4.1907
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/ActionsPanel/ActionsPanel.test.js +133 -49
- package/cjs/AttributeListItem/AttributeListItem.spec.js +147 -118
- package/cjs/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/cjs/AttributesErrorsPanel/components/Error/Error.specs.js +96 -90
- package/cjs/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/cjs/AttributesErrorsPanel/store.test-data.js +29 -0
- package/cjs/AttributesFilterSelector/AttributesFilterSelector.test.js +127 -105
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/cjs/AttributesValuesEditor/AttributesValuesEditor.test.js +92 -88
- package/cjs/AttributesView/AttributesView.test.js +67 -34
- package/cjs/AutoSizeList/AutoSizeList.test.js +81 -59
- package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +15 -31
- package/cjs/BarChart/BarChart.test.js +128 -65
- package/cjs/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/cjs/BasicViewContent/BasicViewContent.test.js +7 -9
- package/cjs/BlobRenderer/BlobRenderer.test.js +28 -9
- package/cjs/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/cjs/BubbleChart/BubbleChart.test.js +111 -87
- package/cjs/CloudChart/CloudChart.test.js +95 -36
- package/cjs/CollaborationItem/CollaborationItem.test.js +67 -30
- package/cjs/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/cjs/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -81
- package/cjs/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/cjs/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/cjs/CollapseButton/CollapseButton.test.js +74 -15
- package/cjs/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/cjs/ColorBar/ColorBar.test.js +13 -15
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/cjs/CommentsContainer/CommentsContainer.test.js +282 -211
- package/cjs/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +183 -122
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/cjs/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/cjs/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/cjs/ConnectionEditor/ConnectionEditor.test.js +299 -282
- package/esm/ActionsPanel/ActionsPanel.test.js +133 -49
- package/esm/AttributeListItem/AttributeListItem.spec.js +149 -97
- package/esm/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/esm/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/esm/AttributesErrorsPanel/components/Error/Error.specs.js +98 -72
- package/esm/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/esm/AttributesErrorsPanel/store.test-data.js +26 -0
- package/esm/AttributesFilterSelector/AttributesFilterSelector.test.js +129 -84
- package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/esm/AttributesValuesEditor/AttributesValuesEditor.test.js +94 -67
- package/esm/AttributesView/AttributesView.test.js +67 -34
- package/esm/AutoSizeList/AutoSizeList.test.js +81 -59
- package/esm/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +16 -32
- package/esm/BarChart/BarChart.test.js +128 -65
- package/esm/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/esm/BasicViewContent/BasicViewContent.test.js +7 -9
- package/esm/BlobRenderer/BlobRenderer.test.js +28 -9
- package/esm/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/esm/BubbleChart/BubbleChart.test.js +111 -87
- package/esm/CloudChart/CloudChart.test.js +95 -36
- package/esm/CollaborationItem/CollaborationItem.test.js +67 -30
- package/esm/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/esm/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -58
- package/esm/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/esm/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/esm/CollapseButton/CollapseButton.test.js +74 -15
- package/esm/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/esm/ColorBar/ColorBar.test.js +13 -15
- package/esm/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/esm/CommentsContainer/CommentsContainer.test.js +282 -211
- package/esm/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +182 -101
- package/esm/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/esm/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/esm/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/esm/ConnectionEditor/ConnectionEditor.test.js +300 -283
- package/package.json +1 -1
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -100
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -46
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.js +0 -27
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -27
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.js +0 -15
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -80
- package/esm/ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -95
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -41
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.js +0 -22
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -22
- package/esm/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/esm/CollaborationItem/components/Avatar/Avatar.test.js +0 -10
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -55
- /package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts → AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
- /package/{cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts → esm/AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
|
@@ -45,296 +45,339 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
};
|
|
57
|
-
var _a, _b;
|
|
58
48
|
import React from 'react';
|
|
59
|
-
import {
|
|
60
|
-
import
|
|
61
|
-
import {
|
|
49
|
+
import { Directions, typeAheadSearch } from '@reltio/mdm-sdk';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { render, screen } from '@testing-library/react';
|
|
52
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
53
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
54
|
+
import { getMuiIconsByName } from '../test-utils';
|
|
62
55
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
63
|
-
import { EditModeAttributesList } from '../EditModeAttributesList';
|
|
64
|
-
import { EntitySelector } from '../EntitySelector';
|
|
65
|
-
import { ConnectionRelationTypeSelector } from '../ConnectionRelationTypeSelector';
|
|
66
|
-
import { ErrorWrapper } from '../ErrorWrapper';
|
|
67
56
|
import { ConnectionEditor } from './ConnectionEditor';
|
|
68
|
-
jest.mock('
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
relation: {
|
|
76
|
-
uri: 'relations/uri$$123',
|
|
77
|
-
attributes: {},
|
|
78
|
-
type: undefined
|
|
79
|
-
},
|
|
80
|
-
entity: null
|
|
81
|
-
};
|
|
82
|
-
var relatedEntity = {
|
|
83
|
-
uri: 'entities/entity123',
|
|
84
|
-
type: 'configuration/entityTypes/HCP'
|
|
85
|
-
};
|
|
86
|
-
var metadata = {
|
|
87
|
-
uri: 'configuration',
|
|
88
|
-
entityTypes: [
|
|
89
|
-
{
|
|
90
|
-
uri: 'configuration/entityTypes/HCP'
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
uri: 'configuration/entityTypes/HCO'
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
uri: 'configuration/entityTypes/Committee'
|
|
57
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getLookups: jest.fn(function () { return Promise.resolve(); }), getDependentLookups: jest.fn(function () { return Promise.resolve(); }), resolveLookupsList: jest.fn(function () { return Promise.resolve(); }), typeAheadSearch: jest.fn().mockReturnValue(Promise.resolve([])) })); });
|
|
58
|
+
describe('ConnectionEditor test', function () {
|
|
59
|
+
var newConnection = {
|
|
60
|
+
relation: {
|
|
61
|
+
uri: 'relations/uri$$123',
|
|
62
|
+
attributes: {},
|
|
63
|
+
type: undefined
|
|
97
64
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
uri: 'configuration/
|
|
65
|
+
entity: null
|
|
66
|
+
};
|
|
67
|
+
var relatedEntity = {
|
|
68
|
+
uri: 'entities/entity123',
|
|
69
|
+
type: 'configuration/entityTypes/HCP'
|
|
70
|
+
};
|
|
71
|
+
var metadata = {
|
|
72
|
+
uri: 'configuration',
|
|
73
|
+
entityTypes: [
|
|
74
|
+
{
|
|
75
|
+
uri: 'configuration/entityTypes/HCP',
|
|
76
|
+
label: 'HCP'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
uri: 'configuration/entityTypes/HCO',
|
|
80
|
+
label: 'HCO'
|
|
109
81
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
{
|
|
83
|
+
uri: 'configuration/entityTypes/Committee',
|
|
84
|
+
label: 'Committee'
|
|
113
85
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
86
|
+
{
|
|
87
|
+
uri: 'configuration/entityTypes/Location',
|
|
88
|
+
label: 'Location'
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
relationTypes: [
|
|
92
|
+
{
|
|
93
|
+
uri: 'configuration/relationTypes/HeadNursing',
|
|
94
|
+
label: 'Head of Nursing',
|
|
95
|
+
startObject: {
|
|
96
|
+
objectTypeURI: 'configuration/entityTypes/HCP',
|
|
97
|
+
uri: 'configuration/relationTypes/HeadNursing/startObject'
|
|
121
98
|
},
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
endObject: {
|
|
100
|
+
objectTypeURI: 'configuration/entityTypes/HCO',
|
|
101
|
+
uri: 'configuration/relationTypes/HeadNursing/endObject'
|
|
102
|
+
},
|
|
103
|
+
direction: 'directed',
|
|
104
|
+
attributes: [
|
|
105
|
+
{
|
|
106
|
+
label: 'Affiliation SubType',
|
|
107
|
+
name: 'AffiliationSubType',
|
|
108
|
+
type: 'String',
|
|
109
|
+
lookupCode: 'AFFILIATION_SUB_TYPE_CD',
|
|
110
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/AffiliationSubType'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: 'First name',
|
|
114
|
+
name: 'FirstName',
|
|
115
|
+
type: 'String',
|
|
116
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/FirstName'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: 'Primary Affiliation Indicator',
|
|
120
|
+
name: 'PrimaryAffiliationIndicator',
|
|
121
|
+
type: 'Boolean',
|
|
122
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/PrimaryAffiliationIndicator'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: 'RelFirstLevelNested',
|
|
126
|
+
name: 'RelFirstLevelNested',
|
|
127
|
+
type: 'Nested',
|
|
128
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested',
|
|
129
|
+
attributes: [
|
|
130
|
+
{
|
|
131
|
+
label: 'FirstLevelNestedSub1',
|
|
132
|
+
name: 'FirstLevelNestedSub1',
|
|
133
|
+
type: 'String',
|
|
134
|
+
lookupCode: 'LANG_CD',
|
|
135
|
+
uri: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested/attributes/FirstLevelNestedSub1'
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
uri: 'configuration/relationTypes/HasAddress',
|
|
143
|
+
label: 'has address',
|
|
144
|
+
startObject: {
|
|
145
|
+
objectTypeURI: 'configuration/entityTypes/HCP',
|
|
146
|
+
uri: 'configuration/relationTypes/HasAddress/startObject'
|
|
127
147
|
},
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
type: 'Nested',
|
|
132
|
-
uri: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested',
|
|
133
|
-
attributes: [
|
|
134
|
-
{
|
|
135
|
-
label: 'FirstLevelNestedSub1',
|
|
136
|
-
name: 'FirstLevelNestedSub1',
|
|
137
|
-
type: 'String',
|
|
138
|
-
lookupCode: 'LANG_CD',
|
|
139
|
-
uri: 'configuration/relationTypes/HCPtoHCA/attributes/RefFirstLevelNested/attributes/FirstLevelNestedSub1'
|
|
140
|
-
}
|
|
141
|
-
]
|
|
148
|
+
endObject: {
|
|
149
|
+
objectTypeURI: 'configuration/entityTypes/Location',
|
|
150
|
+
uri: 'configuration/relationTypes/HasAddress/endObject'
|
|
142
151
|
}
|
|
143
|
-
]
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
uri: 'configuration/relationTypes/HasAddress',
|
|
147
|
-
label: 'has address',
|
|
148
|
-
startObject: {
|
|
149
|
-
objectTypeURI: 'configuration/entityTypes/HCP',
|
|
150
|
-
uri: 'configuration/relationTypes/HasAddress/startObject'
|
|
151
152
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
{
|
|
154
|
+
uri: 'configuration/relationTypes/IsInCommittee',
|
|
155
|
+
label: 'is in committee',
|
|
156
|
+
startObject: {
|
|
157
|
+
objectTypeURI: 'configuration/entityTypes/Committee',
|
|
158
|
+
uri: 'configuration/relationTypes/IsInCommittee/startObject'
|
|
159
|
+
},
|
|
160
|
+
endObject: {
|
|
161
|
+
objectTypeURI: 'configuration/entityTypes/HCP',
|
|
162
|
+
uri: 'configuration/relationTypes/IsInCommittee/endObject'
|
|
163
|
+
}
|
|
155
164
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
]
|
|
166
|
+
};
|
|
167
|
+
var inRelationTypes = [
|
|
168
|
+
__assign(__assign({}, metadata.relationTypes[2]), { startObject: __assign(__assign({}, metadata.relationTypes[2].startObject), { objectType: {
|
|
169
|
+
uri: 'configuration/entityTypes/HCP'
|
|
170
|
+
} }), endObject: __assign(__assign({}, metadata.relationTypes[2].endObject), { objectType: {
|
|
171
|
+
uri: 'configuration/entityTypes/HCO'
|
|
172
|
+
} }) })
|
|
173
|
+
];
|
|
174
|
+
var outRelationTypes = [
|
|
175
|
+
__assign(__assign({}, metadata.relationTypes[0]), { startObject: __assign(__assign({}, metadata.relationTypes[0].startObject), { objectType: {
|
|
176
|
+
uri: 'configuration/entityTypes/HCP'
|
|
177
|
+
} }), endObject: __assign(__assign({}, metadata.relationTypes[0].endObject), { objectType: {
|
|
178
|
+
uri: 'configuration/entityTypes/HCO'
|
|
179
|
+
} }) }),
|
|
180
|
+
__assign(__assign({}, metadata.relationTypes[1]), { startObject: __assign(__assign({}, metadata.relationTypes[1].startObject), { objectType: {
|
|
181
|
+
uri: 'configuration/entityTypes/HCP'
|
|
182
|
+
} }), endObject: __assign(__assign({}, metadata.relationTypes[1].endObject), { objectType: {
|
|
183
|
+
uri: 'configuration/entityTypes/Location'
|
|
184
|
+
} }) })
|
|
185
|
+
];
|
|
186
|
+
var initConnection = {
|
|
187
|
+
relation: {
|
|
188
|
+
attributes: {
|
|
189
|
+
FirstName: [
|
|
190
|
+
{
|
|
191
|
+
type: 'configuration/relationTypes/HCPtoHCA/attributes/FirstName',
|
|
192
|
+
ov: true,
|
|
193
|
+
value: 'HCP_5',
|
|
194
|
+
uri: 'relations/19oYeyx1/attributes/FirstName/1dg2njmxf'
|
|
195
|
+
}
|
|
196
|
+
]
|
|
163
197
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
};
|
|
171
|
-
var inRelationTypes = (_a = metadata.relationTypes) === null || _a === void 0 ? void 0 : _a.slice(2, 3);
|
|
172
|
-
var outRelationTypes = (_b = metadata.relationTypes) === null || _b === void 0 ? void 0 : _b.slice(0, 2);
|
|
173
|
-
var initConnection = {
|
|
174
|
-
relation: {
|
|
175
|
-
attributes: {
|
|
176
|
-
FirstName: [
|
|
177
|
-
{
|
|
178
|
-
type: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
179
|
-
ov: true,
|
|
180
|
-
value: 'HCP_5',
|
|
181
|
-
uri: 'entities/19oYeyx1/attributes/FirstName/1dg2njmxf'
|
|
182
|
-
}
|
|
183
|
-
]
|
|
198
|
+
uri: 'relation/uri',
|
|
199
|
+
type: 'configuration/relationTypes/HeadNursing',
|
|
200
|
+
direction: 'out',
|
|
201
|
+
startDate: 123
|
|
184
202
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
210
|
-
|
|
203
|
+
entity: {
|
|
204
|
+
type: 'configuration/entityTypes/HCO',
|
|
205
|
+
uri: 'entities/uriHCO',
|
|
206
|
+
label: 'initRelationEntity'
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var mdmValues = {
|
|
210
|
+
metadata: metadata,
|
|
211
|
+
globalSearchRequestOptions: {},
|
|
212
|
+
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] },
|
|
213
|
+
lookups: {}
|
|
214
|
+
};
|
|
215
|
+
var onChangeAttribute = jest.fn();
|
|
216
|
+
var onAddAttributes = jest.fn();
|
|
217
|
+
var onRemoveAttribute = jest.fn();
|
|
218
|
+
var onChangeRelationType = jest.fn();
|
|
219
|
+
var onChangeEntity = jest.fn();
|
|
220
|
+
var defaultProps = {
|
|
221
|
+
connection: initConnection,
|
|
222
|
+
onChangeAttribute: onChangeAttribute,
|
|
223
|
+
onAddAttributes: onAddAttributes,
|
|
224
|
+
onRemoveAttribute: onRemoveAttribute,
|
|
225
|
+
showEmptyEditors: true
|
|
226
|
+
};
|
|
227
|
+
var propsWithRelations = __assign(__assign({}, defaultProps), { connection: newConnection, relatedEntity: relatedEntity, inRelationTypes: inRelationTypes, outRelationTypes: outRelationTypes, onChangeRelationType: onChangeRelationType, onChangeEntity: onChangeEntity });
|
|
228
|
+
var setUp = function (props) {
|
|
229
|
+
if (props === void 0) { props = defaultProps; }
|
|
230
|
+
var Providers = function (_a) {
|
|
231
|
+
var children = _a.children;
|
|
232
|
+
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
|
|
233
|
+
React.createElement(MdmModuleProvider, { values: mdmValues }, children)));
|
|
234
|
+
};
|
|
235
|
+
var user = userEvent.setup();
|
|
236
|
+
return __assign({ user: user }, render(React.createElement(ConnectionEditor, __assign({}, props)), { wrapper: Providers }));
|
|
237
|
+
};
|
|
238
|
+
afterEach(function () {
|
|
239
|
+
jest.clearAllMocks();
|
|
240
|
+
});
|
|
211
241
|
it('should render EditModeAttributesList', function () {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
expect(
|
|
215
|
-
expect(component.find(EditModeAttributesList).prop('attrTypes')).toEqual(__spreadArray(__spreadArray([], ACTIVENESS_ATTR_TYPES, true), (((_a = metadata.relationTypes) === null || _a === void 0 ? void 0 : _a[0].attributes) || []), true));
|
|
216
|
-
expect(component.find(EditModeAttributesList).prop('entity')).toEqual({
|
|
217
|
-
attributes: initConnection.relation.attributes,
|
|
218
|
-
startDate: 123
|
|
219
|
-
});
|
|
220
|
-
expect(component.find(EditModeAttributesList).prop('showEmptyEditors')).toBe(true);
|
|
221
|
-
expect(component.find(EditModeAttributesList).prop('mode')).toBe('Editing');
|
|
222
|
-
expect(component.find(EditModeAttributesList).prop('parentUri')).toBe(initConnection.relation.uri);
|
|
223
|
-
expect(component.find(EditModeAttributesList).prop('onAddAttributes')).toBe(props.onAddAttributes);
|
|
224
|
-
expect(component.find(EditModeAttributesList).prop('onChangeAttribute')).toBe(props.onChangeAttribute);
|
|
225
|
-
expect(component.find(EditModeAttributesList).prop('onDeleteAttribute')).toBe(props.onRemoveAttribute);
|
|
242
|
+
setUp();
|
|
243
|
+
expect(screen.queryByText('First name')).toBeInTheDocument();
|
|
244
|
+
expect(screen.queryAllByTestId('reltio-edit-attribute')).toHaveLength(6);
|
|
226
245
|
});
|
|
246
|
+
it('should call onAddAttributes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
247
|
+
var user;
|
|
248
|
+
return __generator(this, function (_a) {
|
|
249
|
+
switch (_a.label) {
|
|
250
|
+
case 0:
|
|
251
|
+
user = setUp().user;
|
|
252
|
+
return [4 /*yield*/, user.click(screen.getByRole('button', { name: 'More attributes' }))];
|
|
253
|
+
case 1:
|
|
254
|
+
_a.sent();
|
|
255
|
+
return [4 /*yield*/, user.click(screen.getByRole('menuitem', { name: 'First name' }))];
|
|
256
|
+
case 2:
|
|
257
|
+
_a.sent();
|
|
258
|
+
return [4 /*yield*/, user.click(screen.getByRole('presentation').firstChild)];
|
|
259
|
+
case 3:
|
|
260
|
+
_a.sent();
|
|
261
|
+
expect(onAddAttributes).toHaveBeenCalledWith([
|
|
262
|
+
{ attributeType: metadata.relationTypes[0].attributes[1], parentUri: initConnection.relation.uri }
|
|
263
|
+
]);
|
|
264
|
+
return [2 /*return*/];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}); });
|
|
268
|
+
it('should call onChangeAttribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var user, firstNameValueInput;
|
|
270
|
+
return __generator(this, function (_a) {
|
|
271
|
+
switch (_a.label) {
|
|
272
|
+
case 0:
|
|
273
|
+
user = setUp().user;
|
|
274
|
+
firstNameValueInput = screen.getAllByRole('textbox')[2];
|
|
275
|
+
return [4 /*yield*/, user.type(firstNameValueInput, 'newValue{Enter}')];
|
|
276
|
+
case 1:
|
|
277
|
+
_a.sent();
|
|
278
|
+
expect(onChangeAttribute).toHaveBeenCalledWith({
|
|
279
|
+
attributeType: metadata.relationTypes[0].attributes[1],
|
|
280
|
+
uri: initConnection.relation.attributes.FirstName[0].uri,
|
|
281
|
+
value: 'HCP_5newValue'
|
|
282
|
+
});
|
|
283
|
+
return [2 /*return*/];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}); });
|
|
287
|
+
it('should call onRemoveAttribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
288
|
+
var user, firstNameDeleteButton;
|
|
289
|
+
return __generator(this, function (_a) {
|
|
290
|
+
switch (_a.label) {
|
|
291
|
+
case 0:
|
|
292
|
+
user = setUp().user;
|
|
293
|
+
firstNameDeleteButton = getMuiIconsByName('Delete')[3];
|
|
294
|
+
return [4 /*yield*/, user.click(firstNameDeleteButton)];
|
|
295
|
+
case 1:
|
|
296
|
+
_a.sent();
|
|
297
|
+
expect(onRemoveAttribute).toHaveBeenCalledWith({
|
|
298
|
+
attributeType: metadata.relationTypes[0].attributes[1],
|
|
299
|
+
uri: initConnection.relation.attributes.FirstName[0].uri
|
|
300
|
+
});
|
|
301
|
+
return [2 /*return*/];
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}); });
|
|
227
305
|
it('should render ConnectionRelationTypeSelector and EntitySelector', function () {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
inRelationTypes: inRelationTypes,
|
|
232
|
-
outRelationTypes: outRelationTypes,
|
|
233
|
-
onChangeRelationType: jest.fn(),
|
|
234
|
-
onChangeEntity: jest.fn()
|
|
235
|
-
};
|
|
236
|
-
var component = setUpMount(props);
|
|
237
|
-
expect(component.find(ConnectionRelationTypeSelector)).toHaveLength(1);
|
|
238
|
-
expect(component.find(ErrorWrapper)).toHaveLength(1);
|
|
239
|
-
expect(component.find(EntitySelector)).toHaveLength(1);
|
|
240
|
-
var compatibleRelation = {
|
|
241
|
-
relationType: initConnection.relation.type,
|
|
242
|
-
direction: initConnection.relation.direction
|
|
243
|
-
};
|
|
244
|
-
expect(component.find(ConnectionRelationTypeSelector).prop('relation')).toEqual(compatibleRelation);
|
|
245
|
-
expect(component.find(EntitySelector).prop('onChange')).toBe(props.onChangeEntity);
|
|
246
|
-
var compatibleEntity = {
|
|
247
|
-
entityUri: initConnection.entity.uri,
|
|
248
|
-
entityType: initConnection.entity.type,
|
|
249
|
-
entityLabel: '<No label>'
|
|
250
|
-
};
|
|
251
|
-
expect(component.find(EntitySelector).prop('entity')).toEqual(compatibleEntity);
|
|
252
|
-
expect(component.find(EntitySelector).prop('entityTypesUris')).toEqual(['configuration/entityTypes/HCO']);
|
|
253
|
-
});
|
|
254
|
-
it('should set entityTypesUris prop for EntitySelector', function () {
|
|
255
|
-
var props = {
|
|
256
|
-
connection: newConnection,
|
|
257
|
-
relatedEntity: relatedEntity,
|
|
258
|
-
inRelationTypes: inRelationTypes,
|
|
259
|
-
outRelationTypes: outRelationTypes,
|
|
260
|
-
onChangeRelationType: jest.fn(),
|
|
261
|
-
onChangeEntity: jest.fn()
|
|
262
|
-
};
|
|
263
|
-
var component = setUpMount(props);
|
|
264
|
-
expect(component.find(EntitySelector).prop('entityTypesUris')).toEqual([
|
|
265
|
-
'configuration/entityTypes/HCO',
|
|
266
|
-
'configuration/entityTypes/Location',
|
|
267
|
-
'configuration/entityTypes/Committee'
|
|
268
|
-
]);
|
|
306
|
+
setUp(__assign(__assign({}, propsWithRelations), { connection: initConnection }));
|
|
307
|
+
expect(screen.queryByText('Head of Nursing')).toBeInTheDocument();
|
|
308
|
+
expect(screen.queryByText('Select HCO profile')).toBeInTheDocument();
|
|
269
309
|
});
|
|
310
|
+
it('should call onChangeEntity for EntitySelector', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
311
|
+
var newEntity, wrongEntity, user, profileSelector;
|
|
312
|
+
return __generator(this, function (_a) {
|
|
313
|
+
switch (_a.label) {
|
|
314
|
+
case 0:
|
|
315
|
+
newEntity = {
|
|
316
|
+
uri: 'entities/entityCommittee',
|
|
317
|
+
type: 'configuration/entityTypes/Committee',
|
|
318
|
+
label: 'Committee'
|
|
319
|
+
};
|
|
320
|
+
wrongEntity = {
|
|
321
|
+
uri: 'entities/wrongEntity',
|
|
322
|
+
type: 'configuration/entityTypes/HCP',
|
|
323
|
+
label: 'WrongEntity'
|
|
324
|
+
};
|
|
325
|
+
typeAheadSearch.mockResolvedValueOnce([newEntity]);
|
|
326
|
+
user = setUp(propsWithRelations).user;
|
|
327
|
+
profileSelector = screen.getAllByRole('textbox')[1];
|
|
328
|
+
return [4 /*yield*/, user.click(profileSelector)];
|
|
329
|
+
case 1:
|
|
330
|
+
_a.sent();
|
|
331
|
+
expect(screen.queryByText(wrongEntity.label)).not.toBeInTheDocument();
|
|
332
|
+
return [4 /*yield*/, user.click(screen.getByRole('menuitem', { name: 'C Committee' }))];
|
|
333
|
+
case 2:
|
|
334
|
+
_a.sent();
|
|
335
|
+
expect(onChangeEntity).toHaveBeenCalledWith(__assign(__assign({}, newEntity), { entityType: metadata.entityTypes[2] }));
|
|
336
|
+
return [2 /*return*/];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}); });
|
|
270
340
|
it('should call onChangeRelationType for ConnectionRelationTypeSelector, if relation type was changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
271
|
-
var
|
|
341
|
+
var user, relationshipTypeSelector;
|
|
272
342
|
return __generator(this, function (_a) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
component.update();
|
|
291
|
-
expect(onChangeRelationType).toHaveBeenCalledWith({
|
|
292
|
-
type: newRelationType.type.uri,
|
|
293
|
-
direction: newRelationType.direction
|
|
294
|
-
});
|
|
295
|
-
return [2 /*return*/];
|
|
343
|
+
switch (_a.label) {
|
|
344
|
+
case 0:
|
|
345
|
+
user = setUp(propsWithRelations).user;
|
|
346
|
+
expect(onChangeRelationType).not.toHaveBeenCalled();
|
|
347
|
+
relationshipTypeSelector = screen.getAllByRole('textbox')[0];
|
|
348
|
+
return [4 /*yield*/, user.click(relationshipTypeSelector)];
|
|
349
|
+
case 1:
|
|
350
|
+
_a.sent();
|
|
351
|
+
return [4 /*yield*/, user.click(screen.getByRole('menuitem', { name: 'H L has address undefined ↔ undefined' }))];
|
|
352
|
+
case 2:
|
|
353
|
+
_a.sent();
|
|
354
|
+
expect(onChangeRelationType).toHaveBeenCalledWith({
|
|
355
|
+
direction: Directions.OUT,
|
|
356
|
+
type: 'configuration/relationTypes/HasAddress'
|
|
357
|
+
});
|
|
358
|
+
return [2 /*return*/];
|
|
359
|
+
}
|
|
296
360
|
});
|
|
297
361
|
}); });
|
|
298
362
|
it('should call onChangeRelationType on mount for ConnectionRelationTypeSelector, if available relation type is only one', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
-
var onChangeRelationType, component;
|
|
300
363
|
return __generator(this, function (_a) {
|
|
301
|
-
|
|
302
|
-
component = setUpMount({
|
|
303
|
-
connection: newConnection,
|
|
304
|
-
relatedEntity: relatedEntity,
|
|
305
|
-
inRelationTypes: inRelationTypes === null || inRelationTypes === void 0 ? void 0 : inRelationTypes.slice(0, 1),
|
|
306
|
-
outRelationTypes: [],
|
|
307
|
-
onChangeRelationType: onChangeRelationType,
|
|
308
|
-
onChangeEntity: jest.fn()
|
|
309
|
-
});
|
|
310
|
-
expect(component.find(ConnectionRelationTypeSelector)).toHaveLength(1);
|
|
364
|
+
setUp(__assign(__assign({}, propsWithRelations), { inRelationTypes: inRelationTypes === null || inRelationTypes === void 0 ? void 0 : inRelationTypes.slice(0, 1), outRelationTypes: [] }));
|
|
311
365
|
expect(onChangeRelationType).toHaveBeenCalledWith({
|
|
312
366
|
type: 'configuration/relationTypes/IsInCommittee',
|
|
313
|
-
direction:
|
|
367
|
+
direction: Directions.IN
|
|
314
368
|
});
|
|
315
369
|
return [2 /*return*/];
|
|
316
370
|
});
|
|
317
371
|
}); });
|
|
318
372
|
it('should call onChangeRelationType for ConnectionRelationTypeSelector, after entity selected and compatible relation type is only one', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
|
-
var
|
|
373
|
+
var rerender, newProps;
|
|
320
374
|
return __generator(this, function (_a) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
connection: newConnection,
|
|
324
|
-
relatedEntity: relatedEntity,
|
|
325
|
-
inRelationTypes: inRelationTypes,
|
|
326
|
-
outRelationTypes: outRelationTypes,
|
|
327
|
-
onChangeRelationType: onChangeRelationType,
|
|
328
|
-
onChangeEntity: jest.fn()
|
|
329
|
-
});
|
|
330
|
-
expect(component.find(ConnectionRelationTypeSelector)).toHaveLength(1);
|
|
331
|
-
component.setProps({
|
|
332
|
-
connection: __assign(__assign({}, newConnection), { entity: {
|
|
375
|
+
rerender = setUp(propsWithRelations).rerender;
|
|
376
|
+
newProps = __assign(__assign({}, propsWithRelations), { connection: __assign(__assign({}, newConnection), { entity: {
|
|
333
377
|
uri: 'entities/entityCommittee',
|
|
334
378
|
type: 'configuration/entityTypes/Committee'
|
|
335
|
-
} })
|
|
336
|
-
});
|
|
337
|
-
component.update();
|
|
379
|
+
} }) });
|
|
380
|
+
rerender(React.createElement(ConnectionEditor, __assign({}, newProps)));
|
|
338
381
|
expect(onChangeRelationType).toHaveBeenCalledWith({
|
|
339
382
|
type: 'configuration/relationTypes/IsInCommittee',
|
|
340
383
|
direction: 'in'
|
|
@@ -342,30 +385,4 @@ describe('ConnectionEditor test', function () {
|
|
|
342
385
|
return [2 /*return*/];
|
|
343
386
|
});
|
|
344
387
|
}); });
|
|
345
|
-
it('should call onChangeEntity for EntitySelector', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
346
|
-
var onChangeEntity, component, newEntity;
|
|
347
|
-
return __generator(this, function (_a) {
|
|
348
|
-
onChangeEntity = jest.fn();
|
|
349
|
-
component = setUpMount({
|
|
350
|
-
connection: newConnection,
|
|
351
|
-
relatedEntity: relatedEntity,
|
|
352
|
-
inRelationTypes: inRelationTypes,
|
|
353
|
-
outRelationTypes: outRelationTypes,
|
|
354
|
-
onChangeRelationType: jest.fn(),
|
|
355
|
-
onChangeEntity: onChangeEntity
|
|
356
|
-
});
|
|
357
|
-
newEntity = {
|
|
358
|
-
uri: 'entities/entityCommittee',
|
|
359
|
-
type: 'configuration/entityTypes/Committee',
|
|
360
|
-
label: 'Committee',
|
|
361
|
-
entityType: { uri: 'configuration/entityTypes/Committee' }
|
|
362
|
-
};
|
|
363
|
-
act(function () {
|
|
364
|
-
component.find(EntitySelector).prop('onChange')(newEntity);
|
|
365
|
-
});
|
|
366
|
-
component.update();
|
|
367
|
-
expect(onChangeEntity).toHaveBeenCalledWith(newEntity);
|
|
368
|
-
return [2 /*return*/];
|
|
369
|
-
});
|
|
370
|
-
}); });
|
|
371
388
|
});
|