@reltio/components 1.4.2027 → 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/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
|
@@ -46,10 +46,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import React from 'react';
|
|
49
|
-
import
|
|
50
|
-
import {
|
|
49
|
+
import moment from 'moment';
|
|
50
|
+
import { render, screen } from '@testing-library/react';
|
|
51
|
+
import userEvent from '@testing-library/user-event';
|
|
51
52
|
import { updateDueDateForTask } from '@reltio/mdm-sdk';
|
|
52
|
-
import {
|
|
53
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
54
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
53
55
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
54
56
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
55
57
|
import { showWorkflowError } from '../helpers/errors';
|
|
@@ -58,9 +60,6 @@ jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.re
|
|
|
58
60
|
jest.mock('../helpers/errors', function () { return ({
|
|
59
61
|
showWorkflowError: jest.fn()
|
|
60
62
|
}); });
|
|
61
|
-
jest.mock('../../../DateEditor', function () { return ({
|
|
62
|
-
DateEditor: function () { return null; }
|
|
63
|
-
}); });
|
|
64
63
|
var updateTaskState = jest.fn();
|
|
65
64
|
var workflowTaskContextValue = { updateTaskState: updateTaskState };
|
|
66
65
|
var defaultUser = {
|
|
@@ -84,13 +83,15 @@ var defaultMdmValues = {
|
|
|
84
83
|
workflowEnvironmentUrl: workflowEnvironmentUrl
|
|
85
84
|
};
|
|
86
85
|
var taskId = 'id1';
|
|
87
|
-
var dueDate =
|
|
86
|
+
var dueDate = moment('01/20/2022', 'MM/DD/YYYY').valueOf();
|
|
88
87
|
var defaultProps = { taskId: taskId, dueDate: dueDate };
|
|
89
88
|
var setUp = function (_a) {
|
|
90
89
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
91
|
-
|
|
90
|
+
var user = userEvent.setup();
|
|
91
|
+
return __assign(__assign({}, render(React.createElement(MdmModuleProvider, { values: mdmValues },
|
|
92
92
|
React.createElement(WorkflowTasksContext.Provider, { value: workflowTaskContextValue },
|
|
93
|
-
React.createElement(
|
|
93
|
+
React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
|
|
94
|
+
React.createElement(DueDateField, __assign({}, props))))))), { user: user });
|
|
94
95
|
};
|
|
95
96
|
describe('DueDateField tests', function () {
|
|
96
97
|
beforeAll(function () {
|
|
@@ -100,13 +101,9 @@ describe('DueDateField tests', function () {
|
|
|
100
101
|
jest.clearAllMocks();
|
|
101
102
|
});
|
|
102
103
|
it('should render DateEditor', function () {
|
|
103
|
-
|
|
104
|
-
expect(
|
|
105
|
-
expect(
|
|
106
|
-
disabled: false,
|
|
107
|
-
label: 'Due date',
|
|
108
|
-
value: dueDate
|
|
109
|
-
});
|
|
104
|
+
setUp();
|
|
105
|
+
expect(screen.getByText('Due date')).toBeInTheDocument();
|
|
106
|
+
expect(screen.getByDisplayValue(moment(dueDate).format('MM/DD/YYYY'))).toBeInTheDocument();
|
|
110
107
|
});
|
|
111
108
|
it('should disable DateEditor if user has no permissions to update task', function () {
|
|
112
109
|
var user = __assign(__assign({}, defaultUser), { userPermissions: __assign(__assign({}, defaultUser.userPermissions), { permissions: {
|
|
@@ -115,123 +112,75 @@ describe('DueDateField tests', function () {
|
|
|
115
112
|
}
|
|
116
113
|
} }) });
|
|
117
114
|
var mdmValues = __assign(__assign({}, defaultMdmValues), { user: user });
|
|
118
|
-
|
|
119
|
-
expect(
|
|
120
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
121
|
-
disabled: true
|
|
122
|
-
});
|
|
115
|
+
setUp({ mdmValues: mdmValues });
|
|
116
|
+
expect(screen.getByPlaceholderText('MM/DD/YYYY')).toBeDisabled();
|
|
123
117
|
});
|
|
124
118
|
it('should disable DateEditor if task is closed', function () {
|
|
125
119
|
var props = __assign(__assign({}, defaultProps), { isTaskOpen: false });
|
|
126
|
-
|
|
127
|
-
expect(
|
|
128
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
129
|
-
disabled: true
|
|
130
|
-
});
|
|
120
|
+
setUp({ props: props });
|
|
121
|
+
expect(screen.getByPlaceholderText('MM/DD/YYYY')).toBeDisabled();
|
|
131
122
|
});
|
|
132
123
|
it('should update task on API and UI side on onChange prop calling', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
-
var
|
|
124
|
+
var user, newDate, newDueDate;
|
|
134
125
|
return __generator(this, function (_a) {
|
|
135
126
|
switch (_a.label) {
|
|
136
127
|
case 0:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
component.find(DateEditor).prop('onChange')(newDate);
|
|
144
|
-
});
|
|
145
|
-
component.update();
|
|
146
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
147
|
-
disabled: true
|
|
148
|
-
});
|
|
128
|
+
user = setUp().user;
|
|
129
|
+
newDate = '01/20/2023';
|
|
130
|
+
newDueDate = new Date(newDate).getTime();
|
|
131
|
+
return [4 /*yield*/, user.type(screen.getByPlaceholderText('MM/DD/YYYY'), newDate)];
|
|
132
|
+
case 1:
|
|
133
|
+
_a.sent();
|
|
149
134
|
expect(updateDueDateForTask).toHaveBeenCalledWith({
|
|
150
135
|
workflowPath: workflowPath,
|
|
151
136
|
environment: workflowEnvironmentUrl,
|
|
152
137
|
tenant: tenant.id,
|
|
153
138
|
taskId: taskId,
|
|
154
|
-
dueDate:
|
|
139
|
+
dueDate: newDueDate
|
|
155
140
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
141
|
+
expect(updateTaskState).toHaveBeenCalledWith(taskId, { dueDate: newDueDate });
|
|
142
|
+
return [2 /*return*/];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}); });
|
|
146
|
+
it('should do nothing in case of updating with previous value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
+
var user;
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (_a.label) {
|
|
150
|
+
case 0:
|
|
151
|
+
user = setUp().user;
|
|
152
|
+
return [4 /*yield*/, user.click(screen.getByPlaceholderText('MM/DD/YYYY'))];
|
|
166
153
|
case 1:
|
|
167
154
|
_a.sent();
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
155
|
+
return [4 /*yield*/, user.paste(moment(dueDate).format('MM/DD/YYYY'))];
|
|
156
|
+
case 2:
|
|
157
|
+
_a.sent();
|
|
158
|
+
expect(updateDueDateForTask).not.toHaveBeenCalled();
|
|
159
|
+
expect(updateTaskState).not.toHaveBeenCalled();
|
|
173
160
|
return [2 /*return*/];
|
|
174
161
|
}
|
|
175
162
|
});
|
|
176
163
|
}); });
|
|
177
|
-
it('should do nothing in case of updating with previous value', function () {
|
|
178
|
-
var component = setUp();
|
|
179
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
180
|
-
disabled: false
|
|
181
|
-
});
|
|
182
|
-
var newDate = new Date(dueDate);
|
|
183
|
-
act(function () {
|
|
184
|
-
component.find(DateEditor).prop('onChange')(newDate);
|
|
185
|
-
});
|
|
186
|
-
component.update();
|
|
187
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
188
|
-
disabled: false
|
|
189
|
-
});
|
|
190
|
-
expect(updateDueDateForTask).not.toHaveBeenCalled();
|
|
191
|
-
expect(updateTaskState).not.toHaveBeenCalled();
|
|
192
|
-
});
|
|
193
164
|
it('should show error if update request was unsuccessful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
-
var
|
|
165
|
+
var user, newDate, newDueDate;
|
|
195
166
|
return __generator(this, function (_a) {
|
|
196
167
|
switch (_a.label) {
|
|
197
168
|
case 0:
|
|
198
|
-
updateDueDateForTask.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
component.find(DateEditor).prop('onChange')(newDate);
|
|
206
|
-
});
|
|
207
|
-
component.update();
|
|
208
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
209
|
-
disabled: true
|
|
210
|
-
});
|
|
169
|
+
updateDueDateForTask.mockRejectedValue('error!');
|
|
170
|
+
user = setUp().user;
|
|
171
|
+
newDate = '01/20/2023';
|
|
172
|
+
newDueDate = new Date(newDate).getTime();
|
|
173
|
+
return [4 /*yield*/, user.type(screen.getByPlaceholderText('MM/DD/YYYY'), newDate)];
|
|
174
|
+
case 1:
|
|
175
|
+
_a.sent();
|
|
211
176
|
expect(updateDueDateForTask).toHaveBeenCalledWith({
|
|
212
177
|
workflowPath: workflowPath,
|
|
213
178
|
environment: workflowEnvironmentUrl,
|
|
214
179
|
tenant: tenant.id,
|
|
215
180
|
taskId: taskId,
|
|
216
|
-
dueDate:
|
|
181
|
+
dueDate: newDueDate
|
|
217
182
|
});
|
|
218
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
|
-
return __generator(this, function (_a) {
|
|
220
|
-
switch (_a.label) {
|
|
221
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
222
|
-
case 1:
|
|
223
|
-
_a.sent();
|
|
224
|
-
return [2 /*return*/];
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}); })];
|
|
228
|
-
case 1:
|
|
229
|
-
_a.sent();
|
|
230
|
-
component.update();
|
|
231
183
|
expect(updateTaskState).not.toHaveBeenCalled();
|
|
232
|
-
expect(component.find(DateEditor).props()).toMatchObject({
|
|
233
|
-
disabled: false
|
|
234
|
-
});
|
|
235
184
|
expect(showWorkflowError).toHaveBeenCalledWith('error!');
|
|
236
185
|
return [2 /*return*/];
|
|
237
186
|
}
|
|
@@ -46,10 +46,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import React from 'react';
|
|
49
|
-
import {
|
|
50
|
-
import
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
51
|
import { updatePriorityForTask, WorkflowPriority } from '@reltio/mdm-sdk';
|
|
52
|
-
import { DropDownSelector } from '../../../DropDownSelector';
|
|
53
52
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
54
53
|
import { showWorkflowError } from '../helpers/errors';
|
|
55
54
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
@@ -85,9 +84,10 @@ var priority = WorkflowPriority.medium;
|
|
|
85
84
|
var defaultProps = { taskId: taskId, priority: priority };
|
|
86
85
|
var setUp = function (_a) {
|
|
87
86
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
88
|
-
|
|
87
|
+
var user = userEvent.setup();
|
|
88
|
+
return __assign(__assign({}, render(React.createElement(MdmModuleProvider, { values: mdmValues },
|
|
89
89
|
React.createElement(WorkflowTasksContext.Provider, { value: workflowTaskContextValue },
|
|
90
|
-
React.createElement(PrioritySelector, __assign({}, props)))));
|
|
90
|
+
React.createElement(PrioritySelector, __assign({}, props)))))), { user: user });
|
|
91
91
|
};
|
|
92
92
|
describe('PrioritySelector tests', function () {
|
|
93
93
|
beforeAll(function () {
|
|
@@ -96,78 +96,50 @@ describe('PrioritySelector tests', function () {
|
|
|
96
96
|
afterEach(function () {
|
|
97
97
|
jest.clearAllMocks();
|
|
98
98
|
});
|
|
99
|
-
it('should render DropDownSelector', function () {
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
label: 'High',
|
|
116
|
-
value: WorkflowPriority.high
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
label: 'Urgent',
|
|
120
|
-
value: WorkflowPriority.urgent
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
value: {
|
|
124
|
-
label: 'Medium',
|
|
125
|
-
value: priority
|
|
126
|
-
},
|
|
127
|
-
TextFieldProps: { disabled: false }
|
|
99
|
+
it('should render DropDownSelector', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var user;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
user = setUp().user;
|
|
105
|
+
return [4 /*yield*/, user.click(screen.getByText('Medium'))];
|
|
106
|
+
case 1:
|
|
107
|
+
_a.sent();
|
|
108
|
+
expect(screen.getByText('Low')).toBeInTheDocument();
|
|
109
|
+
expect(screen.getByText('Medium')).toBeInTheDocument();
|
|
110
|
+
expect(screen.getByText('High')).toBeInTheDocument();
|
|
111
|
+
expect(screen.getByText('Urgent')).toBeInTheDocument();
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
}
|
|
128
114
|
});
|
|
129
|
-
});
|
|
115
|
+
}); });
|
|
130
116
|
it('should disable DropDownSelector if user has no permissions to update task', function () {
|
|
131
|
-
var
|
|
117
|
+
var userWithoutPermissions = __assign(__assign({}, defaultUser), { userPermissions: __assign(__assign({}, defaultUser.userPermissions), { permissions: {
|
|
132
118
|
'workflow:data.tasks': {
|
|
133
119
|
READ: ['otherTenant']
|
|
134
120
|
}
|
|
135
121
|
} }) });
|
|
136
|
-
var mdmValues = __assign(__assign({}, defaultMdmValues), { user:
|
|
137
|
-
|
|
138
|
-
expect(
|
|
139
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
140
|
-
isDisabled: true,
|
|
141
|
-
TextFieldProps: { disabled: true }
|
|
142
|
-
});
|
|
122
|
+
var mdmValues = __assign(__assign({}, defaultMdmValues), { user: userWithoutPermissions });
|
|
123
|
+
setUp({ mdmValues: mdmValues });
|
|
124
|
+
expect(screen.getByRole('combobox')).toBeDisabled();
|
|
143
125
|
});
|
|
144
126
|
it('should disable DropDownSelector if task is closed', function () {
|
|
145
127
|
var props = __assign(__assign({}, defaultProps), { isTaskOpen: false });
|
|
146
|
-
|
|
147
|
-
expect(
|
|
148
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
149
|
-
isDisabled: true,
|
|
150
|
-
TextFieldProps: { disabled: true }
|
|
151
|
-
});
|
|
128
|
+
setUp({ props: props });
|
|
129
|
+
expect(screen.getByRole('combobox')).toBeDisabled();
|
|
152
130
|
});
|
|
153
|
-
it('should update task on API and UI side on
|
|
154
|
-
var
|
|
131
|
+
it('should update task on API and UI side on change priority', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
132
|
+
var user;
|
|
155
133
|
return __generator(this, function (_a) {
|
|
156
134
|
switch (_a.label) {
|
|
157
135
|
case 0:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
component.update();
|
|
167
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
168
|
-
isDisabled: true,
|
|
169
|
-
TextFieldProps: { disabled: true }
|
|
170
|
-
});
|
|
136
|
+
user = setUp().user;
|
|
137
|
+
return [4 /*yield*/, user.click(screen.getByText('Medium'))];
|
|
138
|
+
case 1:
|
|
139
|
+
_a.sent();
|
|
140
|
+
return [4 /*yield*/, user.click(screen.getByText('Urgent'))];
|
|
141
|
+
case 2:
|
|
142
|
+
_a.sent();
|
|
171
143
|
expect(updatePriorityForTask).toHaveBeenCalledWith({
|
|
172
144
|
workflowPath: workflowPath,
|
|
173
145
|
environment: workflowEnvironmentUrl,
|
|
@@ -175,64 +147,42 @@ describe('PrioritySelector tests', function () {
|
|
|
175
147
|
taskId: taskId,
|
|
176
148
|
priority: WorkflowPriority.urgent
|
|
177
149
|
});
|
|
178
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
-
return __generator(this, function (_a) {
|
|
180
|
-
switch (_a.label) {
|
|
181
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
182
|
-
case 1:
|
|
183
|
-
_a.sent();
|
|
184
|
-
return [2 /*return*/];
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}); })];
|
|
188
|
-
case 1:
|
|
189
|
-
_a.sent();
|
|
190
|
-
component.update();
|
|
191
150
|
expect(updateTaskState).toHaveBeenCalledWith(taskId, { priority: WorkflowPriority.urgent });
|
|
192
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
193
|
-
isDisabled: false,
|
|
194
|
-
TextFieldProps: { disabled: false }
|
|
195
|
-
});
|
|
196
151
|
return [2 /*return*/];
|
|
197
152
|
}
|
|
198
153
|
});
|
|
199
154
|
}); });
|
|
200
|
-
it('should do nothing in case of updating with previous value', function () {
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
155
|
+
it('should do nothing in case of updating with previous value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
156
|
+
var user;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
user = setUp().user;
|
|
161
|
+
return [4 /*yield*/, user.click(screen.getByText('Medium'))];
|
|
162
|
+
case 1:
|
|
163
|
+
_a.sent();
|
|
164
|
+
return [4 /*yield*/, user.click(screen.getByText('Medium'))];
|
|
165
|
+
case 2:
|
|
166
|
+
_a.sent();
|
|
167
|
+
expect(updatePriorityForTask).not.toHaveBeenCalled();
|
|
168
|
+
expect(updateTaskState).not.toHaveBeenCalled();
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
213
171
|
});
|
|
214
|
-
|
|
215
|
-
expect(updateTaskState).not.toHaveBeenCalled();
|
|
216
|
-
});
|
|
172
|
+
}); });
|
|
217
173
|
it('should show error if update request was unsuccessful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
-
var
|
|
174
|
+
var user;
|
|
219
175
|
return __generator(this, function (_a) {
|
|
220
176
|
switch (_a.label) {
|
|
221
177
|
case 0:
|
|
222
|
-
updatePriorityForTask.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
});
|
|
231
|
-
component.update();
|
|
232
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
233
|
-
isDisabled: true,
|
|
234
|
-
TextFieldProps: { disabled: true }
|
|
235
|
-
});
|
|
178
|
+
updatePriorityForTask.mockRejectedValue('error!');
|
|
179
|
+
user = setUp().user;
|
|
180
|
+
return [4 /*yield*/, user.click(screen.getByText('Medium'))];
|
|
181
|
+
case 1:
|
|
182
|
+
_a.sent();
|
|
183
|
+
return [4 /*yield*/, user.click(screen.getByText('Urgent'))];
|
|
184
|
+
case 2:
|
|
185
|
+
_a.sent();
|
|
236
186
|
expect(updatePriorityForTask).toHaveBeenCalledWith({
|
|
237
187
|
workflowPath: workflowPath,
|
|
238
188
|
environment: workflowEnvironmentUrl,
|
|
@@ -240,28 +190,7 @@ describe('PrioritySelector tests', function () {
|
|
|
240
190
|
taskId: taskId,
|
|
241
191
|
priority: WorkflowPriority.urgent
|
|
242
192
|
});
|
|
243
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
244
|
-
return __generator(this, function (_a) {
|
|
245
|
-
switch (_a.label) {
|
|
246
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
247
|
-
case 1:
|
|
248
|
-
_a.sent();
|
|
249
|
-
return [2 /*return*/];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}); })];
|
|
253
|
-
case 1:
|
|
254
|
-
_a.sent();
|
|
255
|
-
component.update();
|
|
256
193
|
expect(updateTaskState).not.toHaveBeenCalled();
|
|
257
|
-
expect(component.find(DropDownSelector).props()).toMatchObject({
|
|
258
|
-
isDisabled: false,
|
|
259
|
-
TextFieldProps: { disabled: false },
|
|
260
|
-
value: {
|
|
261
|
-
label: 'Medium',
|
|
262
|
-
value: priority
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
194
|
expect(showWorkflowError).toHaveBeenCalledWith('error!');
|
|
266
195
|
return [2 /*return*/];
|
|
267
196
|
}
|