@reltio/components 1.4.2209 → 1.4.2210

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.
@@ -71,7 +71,6 @@ var CommentDialogContext_1 = require("../../../../../contexts/CommentDialogConte
71
71
  var DataChangeRequestTaskCard_1 = require("./DataChangeRequestTaskCard");
72
72
  var WorkflowTasksContext_1 = require("../../../../../contexts/WorkflowTasksContext");
73
73
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getDataChangeRequest: jest.fn(), getEntitiesByUris: jest.fn(), runTaskAction: jest.fn() })); });
74
- jest.mock('../../../../../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../../../../../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn() })); });
75
74
  var onActionSuccess = jest.fn();
76
75
  var workflowTaskContextValue = { onActionSuccess: onActionSuccess };
77
76
  describe('DataChangeRequestTaskCard tests', function () {
@@ -266,16 +265,18 @@ describe('DataChangeRequestTaskCard tests', function () {
266
265
  var tenant = { id: 't1', name: 't1' };
267
266
  var workflowPath = 'workflowPath';
268
267
  var workflowEnvironmentUrl = 'workflowEnvironmentUrl';
269
- var mdmValues = {
268
+ var mdmDefaultValues = {
269
+ metadata: metadata,
270
270
  user: {
271
271
  username: userName
272
272
  },
273
273
  tenant: tenant,
274
274
  workflowPath: workflowPath,
275
- workflowEnvironmentUrl: workflowEnvironmentUrl
275
+ workflowEnvironmentUrl: workflowEnvironmentUrl,
276
+ entity: { uri: entityUri }
276
277
  };
277
278
  var setUp = function (_a) {
278
- var _b = _a === void 0 ? {} : _a, _c = _b.task, task = _c === void 0 ? defaultTask : _c;
279
+ var _b = _a === void 0 ? {} : _a, _c = _b.task, task = _c === void 0 ? defaultTask : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? mdmDefaultValues : _d;
279
280
  var user = user_event_1.default.setup();
280
281
  var Providers = function (_a) {
281
282
  var children = _a.children;
@@ -290,9 +291,6 @@ describe('DataChangeRequestTaskCard tests', function () {
290
291
  mdm_sdk_1.getEntitiesByUris.mockResolvedValue(entities);
291
292
  mdm_sdk_1.runTaskAction.mockResolvedValue(null);
292
293
  });
293
- beforeEach(function () {
294
- MdmModuleContext_1.useMdmMetadata.mockReturnValue(metadata);
295
- });
296
294
  afterEach(function () {
297
295
  jest.clearAllMocks();
298
296
  });
@@ -488,6 +486,16 @@ describe('DataChangeRequestTaskCard tests', function () {
488
486
  }
489
487
  });
490
488
  }); });
489
+ it('should not show Review DCR button when current entity is a new created entity by DCR', function () { return __awaiter(void 0, void 0, void 0, function () {
490
+ var mdmValues;
491
+ return __generator(this, function (_a) {
492
+ mdmValues = __assign(__assign({}, mdmDefaultValues), { reviewDCREnabled: true, entity: { uri: "".concat(dcrUri, "/changes/").concat(entityUri) } });
493
+ mdm_sdk_1.getDataChangeRequest.mockResolvedValue(dcr);
494
+ setUp({ mdmValues: mdmValues });
495
+ expect(react_2.screen.queryByRole('button', { name: 'Review DCR' })).not.toBeInTheDocument();
496
+ return [2 /*return*/];
497
+ });
498
+ }); });
491
499
  it('should create correct link for new entity', function () { return __awaiter(void 0, void 0, void 0, function () {
492
500
  var changesWithNewEntity, dcrWithNewEntity, user, linkElement, href;
493
501
  var _a;
@@ -61,12 +61,11 @@ import moment from 'moment';
61
61
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
62
62
  import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
63
63
  import { DCROperationTypes, DCRTypes, getDataChangeRequest, getEntitiesByUris, runTaskAction } from '@reltio/mdm-sdk';
64
- import { MdmModuleProvider, useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
64
+ import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
65
65
  import { CommentDialogProvider } from '../../../../../contexts/CommentDialogContext';
66
66
  import { DataChangeRequestTaskCard } from './DataChangeRequestTaskCard';
67
67
  import { WorkflowTasksContext } from '../../../../../contexts/WorkflowTasksContext';
68
68
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getDataChangeRequest: jest.fn(), getEntitiesByUris: jest.fn(), runTaskAction: jest.fn() })); });
69
- jest.mock('../../../../../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../../../../../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn() })); });
70
69
  var onActionSuccess = jest.fn();
71
70
  var workflowTaskContextValue = { onActionSuccess: onActionSuccess };
72
71
  describe('DataChangeRequestTaskCard tests', function () {
@@ -261,16 +260,18 @@ describe('DataChangeRequestTaskCard tests', function () {
261
260
  var tenant = { id: 't1', name: 't1' };
262
261
  var workflowPath = 'workflowPath';
263
262
  var workflowEnvironmentUrl = 'workflowEnvironmentUrl';
264
- var mdmValues = {
263
+ var mdmDefaultValues = {
264
+ metadata: metadata,
265
265
  user: {
266
266
  username: userName
267
267
  },
268
268
  tenant: tenant,
269
269
  workflowPath: workflowPath,
270
- workflowEnvironmentUrl: workflowEnvironmentUrl
270
+ workflowEnvironmentUrl: workflowEnvironmentUrl,
271
+ entity: { uri: entityUri }
271
272
  };
272
273
  var setUp = function (_a) {
273
- var _b = _a === void 0 ? {} : _a, _c = _b.task, task = _c === void 0 ? defaultTask : _c;
274
+ var _b = _a === void 0 ? {} : _a, _c = _b.task, task = _c === void 0 ? defaultTask : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? mdmDefaultValues : _d;
274
275
  var user = userEvent.setup();
275
276
  var Providers = function (_a) {
276
277
  var children = _a.children;
@@ -285,9 +286,6 @@ describe('DataChangeRequestTaskCard tests', function () {
285
286
  getEntitiesByUris.mockResolvedValue(entities);
286
287
  runTaskAction.mockResolvedValue(null);
287
288
  });
288
- beforeEach(function () {
289
- useMdmMetadata.mockReturnValue(metadata);
290
- });
291
289
  afterEach(function () {
292
290
  jest.clearAllMocks();
293
291
  });
@@ -483,6 +481,16 @@ describe('DataChangeRequestTaskCard tests', function () {
483
481
  }
484
482
  });
485
483
  }); });
484
+ it('should not show Review DCR button when current entity is a new created entity by DCR', function () { return __awaiter(void 0, void 0, void 0, function () {
485
+ var mdmValues;
486
+ return __generator(this, function (_a) {
487
+ mdmValues = __assign(__assign({}, mdmDefaultValues), { reviewDCREnabled: true, entity: { uri: "".concat(dcrUri, "/changes/").concat(entityUri) } });
488
+ getDataChangeRequest.mockResolvedValue(dcr);
489
+ setUp({ mdmValues: mdmValues });
490
+ expect(screen.queryByRole('button', { name: 'Review DCR' })).not.toBeInTheDocument();
491
+ return [2 /*return*/];
492
+ });
493
+ }); });
486
494
  it('should create correct link for new entity', function () { return __awaiter(void 0, void 0, void 0, function () {
487
495
  var changesWithNewEntity, dcrWithNewEntity, user, linkElement, href;
488
496
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2209",
3
+ "version": "1.4.2210",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",