@reltio/sources 1.4.1585 → 1.4.1586-mui5
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/index.ts +1 -0
- package/package.json +38 -21
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +79 -0
- package/public/package.json +22 -0
- package/scripts/build/index.js +20 -0
- package/src/components/CrosswalkTreeView/CrosswalkTreeView.tsx +47 -0
- package/src/components/CrosswalkTreeView/__tests__/CrosswalkTreeView.spec.tsx +72 -0
- package/src/components/CrosswalkTreeView/__tests__/helpers.spec.ts +961 -0
- package/src/components/CrosswalkTreeView/helpers.ts +91 -0
- package/src/components/CrosswalkTreeView/styles.ts +10 -0
- package/src/components/EmptyState/EmptyState.tsx +20 -0
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +13 -0
- package/src/components/EmptyState/icons/EmptySources.svg +43 -0
- package/src/components/EmptyState/styles.ts +19 -0
- package/src/components/LegendTable/LegendTable.tsx +124 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/ContributorRow.tsx +46 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/__tests__/ContributorRow.test.tsx +103 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/styles.ts +31 -0
- package/src/components/LegendTable/LegendTableRow/LegendTableRow.tsx +179 -0
- package/src/components/LegendTable/LegendTableRow/__tests__/LegendTableRow.test.tsx +371 -0
- package/src/components/LegendTable/LegendTableRow/styles.ts +31 -0
- package/src/components/LegendTable/__tests__/LegendTable.test.tsx +273 -0
- package/src/components/LegendTable/__tests__/helpers.test.ts +541 -0
- package/src/components/LegendTable/helpers.ts +64 -0
- package/src/components/LegendTable/styles.ts +17 -0
- package/src/components/LegendView/LegendView.tsx +201 -0
- package/src/components/LegendView/__tests__/LegendView.test.tsx +307 -0
- package/src/components/LegendView/styles.ts +51 -0
- package/src/components/RightSidePanel/RightSidePanel.tsx +25 -0
- package/src/components/RightSidePanel/__tests__/RightSidePanel.test.tsx +28 -0
- package/src/components/RightSidePanel/styles.ts +14 -0
- package/src/components/RulesestsSelector/RulesestsSelector.tsx +31 -0
- package/src/components/RulesestsSelector/RulesetOption/RulesetOption.tsx +25 -0
- package/src/components/RulesestsSelector/RulesetOption/__tests__/RulesetOption.test.tsx +25 -0
- package/src/components/RulesestsSelector/RulesetOption/styles.ts +27 -0
- package/src/components/RulesestsSelector/RulesetsMenuList/RulesetsMenuList.tsx +14 -0
- package/src/components/RulesestsSelector/__tests__/RulesetsSelector.test.tsx +91 -0
- package/src/components/RulesestsSelector/styles.ts +7 -0
- package/src/components/SankeyChart/Link.tsx +31 -0
- package/src/components/SankeyChart/MergeTooltip.tsx +37 -0
- package/src/components/SankeyChart/Node.tsx +137 -0
- package/src/components/SankeyChart/SankeyChart.tsx +103 -0
- package/src/components/SankeyChart/__tests__/Link.spec.tsx +127 -0
- package/src/components/SankeyChart/__tests__/MergeTooltip.spec.tsx +22 -0
- package/src/components/SankeyChart/__tests__/Node.spec.tsx +248 -0
- package/src/components/SankeyChart/__tests__/SankeyChart.spec.tsx +161 -0
- package/src/components/SankeyChart/__tests__/__snapshots__/SankeyChart.spec.tsx.snap +183 -0
- package/src/components/SankeyChart/sankey.ts +322 -0
- package/src/components/SankeyChart/styles.ts +41 -0
- package/src/components/SankeyChart/useSankey.tsx +44 -0
- package/src/components/SelectableTree/SelectableTree.tsx +46 -0
- package/src/components/SelectableTree/__tests__/SelectableTree.test.tsx +28 -0
- package/src/components/SelectableTree/__tests__/__snapshots__/SelectableTree.test.tsx.snap +59 -0
- package/src/components/SelectableTree/styles.ts +42 -0
- package/src/components/SourcesView/SourcesView.tsx +318 -0
- package/src/components/SourcesView/__tests__/IntegrationSourcesView.spec.tsx +199 -0
- package/src/components/SourcesView/__tests__/SourcesView.spec.tsx +903 -0
- package/src/components/SourcesView/__tests__/data/metadata.data.ts +27 -0
- package/src/components/SourcesView/__tests__/data/store.data.ts +65 -0
- package/src/components/SourcesView/icons/LegendIcon.svg +8 -0
- package/src/components/SourcesView/index.tsx +57 -0
- package/src/components/SourcesView/styles.ts +44 -0
- package/src/components/TreeActionSnackbar/TreeActionSnackbar.tsx +38 -0
- package/src/components/TreeActionSnackbar/__tests__/TreeActionSnackbar.test.tsx +38 -0
- package/src/components/TreeActionSnackbar/styles.ts +11 -0
- package/src/components/UnmergeDialog/UnmergeDialog.tsx +78 -0
- package/src/components/UnmergeDialog/__tests__/UnmergeDialog.test.tsx +124 -0
- package/src/components/UnmergeDialog/__tests__/testData.data.ts +271 -0
- package/src/components/UnmergeDialog/styles.ts +34 -0
- package/src/components/UnsubscribeDialog/UnsubscribeDialog.tsx +64 -0
- package/src/components/UnsubscribeDialog/__tests__/UnsubscribeDialog.test.tsx +59 -0
- package/src/components/UnsubscribeDialog/styles.ts +31 -0
- package/src/hooks/__tests__/useCrosswalkTree.specs.tsx +68 -0
- package/src/hooks/__tests__/useCrosswalkTreeActions.specs.ts +110 -0
- package/src/hooks/__tests__/useCrosswalksDisplay.specs.tsx +213 -0
- package/src/hooks/__tests__/useEntityWithSurvivorshipGroups.specs.ts +160 -0
- package/src/hooks/useCrosswalkTree.ts +38 -0
- package/src/hooks/useCrosswalkTreeActions.ts +83 -0
- package/src/hooks/useCrosswalksDisplay.ts +110 -0
- package/src/hooks/useEntityWithSurvivorshipGroups.tsx +51 -0
- package/src/icons/notMatch.svg +14 -0
- package/src/index.ts +1 -0
- package/src/services/errors.ts +11 -0
- package/src/types/LegendMode.ts +5 -0
- package/src/types/SankeyChartData.ts +31 -0
- package/src/types/SourcesSavedState.ts +3 -0
- package/src/types/UnmergeContributorEvent.ts +7 -0
- package/src/types/UnsubscribeContributorEvent.ts +6 -0
- package/src/types/index.ts +4 -0
- package/tsconfig.json +4 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -42
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {shallow, mount} from 'enzyme';
|
|
3
|
+
import {act} from 'react-dom/test-utils';
|
|
4
|
+
|
|
5
|
+
import LegendTable from '../LegendTable';
|
|
6
|
+
import * as LegendTableRowImport from '../LegendTableRow/LegendTableRow';
|
|
7
|
+
import LegendTableRow from '../LegendTableRow/LegendTableRow';
|
|
8
|
+
import * as helpers from '../helpers';
|
|
9
|
+
import {EmptyStub} from '@reltio/components';
|
|
10
|
+
import {MetadataPermissions} from '@reltio/mdm-sdk';
|
|
11
|
+
|
|
12
|
+
describe('LegendTable tests', () => {
|
|
13
|
+
const entityType = {
|
|
14
|
+
uri: 'configuration/entityTypes/HCP',
|
|
15
|
+
label: 'Label',
|
|
16
|
+
attributes: [],
|
|
17
|
+
type: 'testType'
|
|
18
|
+
};
|
|
19
|
+
const props = {
|
|
20
|
+
entity: {uri: 'entities/1', label: 'Label', type: 'configuration/entityTypes/HCP'},
|
|
21
|
+
entityType: entityType,
|
|
22
|
+
disableUnmerge: false,
|
|
23
|
+
canUnmerge: true,
|
|
24
|
+
contributors: [{uri: 'tree', crosswalks: []}],
|
|
25
|
+
selectedAttributeTypes: [
|
|
26
|
+
{
|
|
27
|
+
uri: 'configuration/entityTypes/HCP/attributes/Int',
|
|
28
|
+
type: 'Int',
|
|
29
|
+
label: 'Integer',
|
|
30
|
+
name: 'Int'
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
onChangeVisibleCrosswalks: jest.fn(),
|
|
34
|
+
onAddCrosswalk: jest.fn(),
|
|
35
|
+
onEditCrosswalk: jest.fn(),
|
|
36
|
+
onDeleteCrosswalk: jest.fn(),
|
|
37
|
+
onUnmergeContributor: jest.fn(),
|
|
38
|
+
onUnsubscribeContributor: jest.fn()
|
|
39
|
+
};
|
|
40
|
+
const tableRowsDataMock = [
|
|
41
|
+
{
|
|
42
|
+
contributorUri: 'entities/2',
|
|
43
|
+
crosswalksBySources: [
|
|
44
|
+
{
|
|
45
|
+
source: 'configuration/sources/Reltio',
|
|
46
|
+
crosswalksByTypes: {
|
|
47
|
+
empty: [],
|
|
48
|
+
simple: [
|
|
49
|
+
{
|
|
50
|
+
uri: 'entities/2/crosswalks/1',
|
|
51
|
+
value: '123',
|
|
52
|
+
type: 'configuration/sources/Reltio'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
dependent: []
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
contributorUri: 'entities/3',
|
|
62
|
+
crosswalksBySources: [
|
|
63
|
+
{
|
|
64
|
+
source: 'configuration/sources/FB',
|
|
65
|
+
crosswalksByTypes: {
|
|
66
|
+
empty: [],
|
|
67
|
+
simple: [],
|
|
68
|
+
dependent: [
|
|
69
|
+
{
|
|
70
|
+
uri: 'entities/3/crosswalks/1',
|
|
71
|
+
value: '456',
|
|
72
|
+
type: 'configuration/sources/FB'
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
beforeAll(() => {
|
|
82
|
+
jest.spyOn(helpers, 'buildTableRowsData').mockReturnValue(tableRowsDataMock);
|
|
83
|
+
jest.spyOn(LegendTableRowImport, 'default').mockImplementation(EmptyStub);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should render correctly', () => {
|
|
87
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
88
|
+
const rows = wrapper.find(LegendTableRow);
|
|
89
|
+
expect(rows.length).toBe(2);
|
|
90
|
+
rows.forEach((row, index) => {
|
|
91
|
+
expect(row.props()).toMatchObject({
|
|
92
|
+
canUnmerge: true,
|
|
93
|
+
contributorUri: tableRowsDataMock[index].contributorUri,
|
|
94
|
+
crosswalksBySources: tableRowsDataMock[index].crosswalksBySources,
|
|
95
|
+
disableAddCrosswalk: false,
|
|
96
|
+
disableEditCrosswalk: false,
|
|
97
|
+
disableDeleteCrosswalk: false,
|
|
98
|
+
onUnsubscribeContributor: props.onUnsubscribeContributor,
|
|
99
|
+
disableUnmergeContributor: false
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should disable rows editing if props.readOnly is true', () => {
|
|
105
|
+
const wrapper = shallow(<LegendTable {...props} readOnly />);
|
|
106
|
+
wrapper.find(LegendTableRow).forEach((row) => {
|
|
107
|
+
expect(row.prop('disableAddCrosswalk')).toBeTruthy();
|
|
108
|
+
expect(row.prop('disableEditCrosswalk')).toBeTruthy();
|
|
109
|
+
expect(row.prop('disableDeleteCrosswalk')).toBeTruthy();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should render LegendTableRow with proper disableAddCrosswalk prop', () => {
|
|
114
|
+
const noAddPermissionType = {
|
|
115
|
+
...entityType,
|
|
116
|
+
access: [MetadataPermissions.READ]
|
|
117
|
+
};
|
|
118
|
+
const wrapperNoAddPermission = shallow(<LegendTable {...props} entityType={noAddPermissionType} />);
|
|
119
|
+
wrapperNoAddPermission.find(LegendTableRow).forEach((row) => {
|
|
120
|
+
expect(row.prop('disableAddCrosswalk')).toBeTruthy();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const haveAddPermissionType = {
|
|
124
|
+
...entityType,
|
|
125
|
+
access: [MetadataPermissions.UPDATE, MetadataPermissions.READ, MetadataPermissions.CREATE]
|
|
126
|
+
};
|
|
127
|
+
const wrapperAddPermission = shallow(<LegendTable {...props} entityType={haveAddPermissionType} />);
|
|
128
|
+
wrapperAddPermission.find(LegendTableRow).forEach((row) => {
|
|
129
|
+
expect(row.prop('disableAddCrosswalk')).toBeFalsy();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should render LegendTableRow with proper disableEditCrosswalk prop', () => {
|
|
134
|
+
const noEditPermissionType = {
|
|
135
|
+
...entityType,
|
|
136
|
+
access: [MetadataPermissions.READ]
|
|
137
|
+
};
|
|
138
|
+
const wrapperNoEditPermission = shallow(<LegendTable {...props} entityType={noEditPermissionType} />);
|
|
139
|
+
wrapperNoEditPermission.find(LegendTableRow).forEach((row) => {
|
|
140
|
+
expect(row.prop('disableEditCrosswalk')).toBeTruthy();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const haveEditPermissionType = {
|
|
144
|
+
...entityType,
|
|
145
|
+
access: [MetadataPermissions.UPDATE, MetadataPermissions.READ]
|
|
146
|
+
};
|
|
147
|
+
const wrapperEditPermission = shallow(<LegendTable {...props} entityType={haveEditPermissionType} />);
|
|
148
|
+
wrapperEditPermission.find(LegendTableRow).forEach((row) => {
|
|
149
|
+
expect(row.prop('disableEditCrosswalk')).toBeFalsy();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should render LegendTableRow with proper disableDeleteCrosswalk prop', () => {
|
|
154
|
+
const noDeletePermissionType = {
|
|
155
|
+
...entityType,
|
|
156
|
+
access: [MetadataPermissions.READ]
|
|
157
|
+
};
|
|
158
|
+
const wrapperNoDeletePermission = shallow(<LegendTable {...props} entityType={noDeletePermissionType} />);
|
|
159
|
+
wrapperNoDeletePermission.find(LegendTableRow).forEach((row) => {
|
|
160
|
+
expect(row.prop('disableDeleteCrosswalk')).toBeTruthy();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const haveDeletePermissionType = {
|
|
164
|
+
...entityType,
|
|
165
|
+
access: [MetadataPermissions.DELETE, MetadataPermissions.UPDATE, MetadataPermissions.READ]
|
|
166
|
+
};
|
|
167
|
+
const wrapperDeletePermission = shallow(<LegendTable {...props} entityType={haveDeletePermissionType} />);
|
|
168
|
+
wrapperDeletePermission.find(LegendTableRow).forEach((row) => {
|
|
169
|
+
expect(row.prop('disableDeleteCrosswalk')).toBeFalsy();
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should call props.onAddCrosswalk on LegendTableRow "onAdd" prop calling', () => {
|
|
174
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
175
|
+
const onAddProps = {
|
|
176
|
+
contributorCrosswalk: {
|
|
177
|
+
type: 'contributorCrosswalk type',
|
|
178
|
+
uri: 'contributorCrosswalk uri',
|
|
179
|
+
value: '123'
|
|
180
|
+
},
|
|
181
|
+
crosswalk: {
|
|
182
|
+
type: 'crosswalk type',
|
|
183
|
+
value: '456'
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
wrapper.find(LegendTableRow).at(0).prop('onAdd')(onAddProps);
|
|
187
|
+
expect(props.onAddCrosswalk).toHaveBeenCalledWith({
|
|
188
|
+
...onAddProps,
|
|
189
|
+
entity: props.entity
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should call props.onEditCrosswalk on LegendTableRow "onEdit" prop calling', () => {
|
|
194
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
195
|
+
const onEditProps = {
|
|
196
|
+
crosswalkId: '370iIXrRf',
|
|
197
|
+
attributeName: 'deleteDate',
|
|
198
|
+
value: '1631905200000'
|
|
199
|
+
};
|
|
200
|
+
wrapper.find(LegendTableRow).at(0).prop('onEdit')(onEditProps);
|
|
201
|
+
expect(props.onEditCrosswalk).toHaveBeenCalledWith({...onEditProps, entityUri: props.entity.uri});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should call props.onDeleteCrosswalk on LegendTableRow "onDelete" prop calling', () => {
|
|
205
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
206
|
+
wrapper.find(LegendTableRow).at(0).prop('onDelete')('123');
|
|
207
|
+
expect(props.onDeleteCrosswalk).toHaveBeenCalledWith({entityUri: props.entity.uri, crosswalkId: '123'});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should toggle expanded sources and call onChangeVisibleCrosswalks correctly', () => {
|
|
211
|
+
const wrapper = mount(<LegendTable {...props} />);
|
|
212
|
+
expect(props.onChangeVisibleCrosswalks).toBeCalledWith([
|
|
213
|
+
{
|
|
214
|
+
uri: 'entities/2/crosswalks/1',
|
|
215
|
+
value: '123',
|
|
216
|
+
type: 'configuration/sources/Reltio'
|
|
217
|
+
}
|
|
218
|
+
]);
|
|
219
|
+
act(() => {
|
|
220
|
+
wrapper.find(LegendTableRow).at(1).prop('onToggleSourceExpanded')('configuration/sources/FB');
|
|
221
|
+
});
|
|
222
|
+
expect(props.onChangeVisibleCrosswalks).toBeCalledWith([
|
|
223
|
+
{
|
|
224
|
+
uri: 'entities/2/crosswalks/1',
|
|
225
|
+
value: '123',
|
|
226
|
+
type: 'configuration/sources/Reltio'
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
uri: 'entities/3/crosswalks/1',
|
|
230
|
+
value: '456',
|
|
231
|
+
type: 'configuration/sources/FB'
|
|
232
|
+
}
|
|
233
|
+
]);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('should accent contributor if props.accentContributors is true', () => {
|
|
237
|
+
const wrapper = shallow(<LegendTable {...props} accentContributors={true} />);
|
|
238
|
+
wrapper.find(LegendTableRow).forEach((row) => {
|
|
239
|
+
expect(row.prop('accentContributor')).toBe(true);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should call props.onUnmergeContributor on LegendTableRow "onUnmerge" prop calling', () => {
|
|
244
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
245
|
+
wrapper.find(LegendTableRow).at(0).prop('onUnmerge')();
|
|
246
|
+
expect(props.onUnmergeContributor).toHaveBeenCalledWith(tableRowsDataMock[0].contributorUri);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('should call props.onUnsubscribeContributor on LegendTableRow "onUnsubscribeContributor" prop calling', () => {
|
|
250
|
+
const wrapper = shallow(<LegendTable {...props} />);
|
|
251
|
+
const unsubscribeEvent = {
|
|
252
|
+
contributorUri: 'cUri1',
|
|
253
|
+
dataTenant: {id: 'id1', label: 'label1', name: 'name1'},
|
|
254
|
+
crosswalk: {uri: 'crUri1', type: 'type1', value: 'value1'}
|
|
255
|
+
};
|
|
256
|
+
wrapper.find(LegendTableRow).at(0).prop('onUnsubscribeContributor')(unsubscribeEvent);
|
|
257
|
+
expect(props.onUnsubscribeContributor).toHaveBeenCalledWith(unsubscribeEvent);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('should provide disableUnmergeContributor === true, if disableUnmerge prop is true', () => {
|
|
261
|
+
const wrapper = shallow(<LegendTable {...props} disableUnmerge={true} />);
|
|
262
|
+
const rows = wrapper.find(LegendTableRow);
|
|
263
|
+
expect(rows.length).toBe(2);
|
|
264
|
+
rows.forEach((row, index) => {
|
|
265
|
+
expect(row.props()).toMatchObject({
|
|
266
|
+
contributorUri: tableRowsDataMock[index].contributorUri,
|
|
267
|
+
crosswalksBySources: tableRowsDataMock[index].crosswalksBySources,
|
|
268
|
+
onUnsubscribeContributor: props.onUnsubscribeContributor,
|
|
269
|
+
disableUnmergeContributor: true
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|