+
{groupOfItems}
);
diff --git a/src/routes/JobSummary/components/cells/OrderCell.js b/src/routes/JobSummary/components/cells/OrderCell.js
index 454dd7c9b..f1ca24332 100644
--- a/src/routes/JobSummary/components/cells/OrderCell.js
+++ b/src/routes/JobSummary/components/cells/OrderCell.js
@@ -1,4 +1,3 @@
-import { isEmpty } from 'lodash';
import {
getRecordActionStatusLabel,
getHotlinkCellFormatter,
@@ -13,7 +12,7 @@ export const OrderCell = ({
jobLogRecords,
sortedItemData,
}) => {
- if (!poLineActionStatus && !isEmpty(sortedItemData)) {
+ if (!poLineActionStatus) {
return fillCellWithNoValues(sortedItemData);
}
diff --git a/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js b/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
index 124e88c86..0992ad755 100644
--- a/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
@@ -10,8 +10,6 @@ import {
import { ErrorCell } from '../ErrorCell';
-const errorProp = 'test error';
-
const sortedItemDataProp = [
[{
actionStatus : 'CREATED',
@@ -35,21 +33,24 @@ const renderErrorCell = ({ error = '', sortedItemData }) => {
describe('ErrorCell component', () => {
it('should be rendered with no axe errors', async () => {
- const { container } = renderErrorCell({ error: errorProp });
+ const { container } = renderErrorCell({ error: 'test error' });
await runAxeTest({ rootNode: container });
});
describe('when error was occured', () => {
it('error message should be rendered', () => {
- const { getByText } = renderErrorCell({ error: errorProp });
+ const { getByText } = renderErrorCell({ error: 'test error' });
expect(getByText('Error')).toBeInTheDocument();
});
describe('when item has an error', () => {
it('error message should be rendered', () => {
- const { getByText } = renderErrorCell({ sortedItemData: sortedItemDataProp });
+ const { getByText } = renderErrorCell({
+ error: 'test error',
+ sortedItemData: sortedItemDataProp,
+ });
expect(getByText('Error')).toBeInTheDocument();
});
diff --git a/src/routes/JobSummary/components/utils.js b/src/routes/JobSummary/components/utils.js
index 31367f511..efae29c99 100644
--- a/src/routes/JobSummary/components/utils.js
+++ b/src/routes/JobSummary/components/utils.js
@@ -5,6 +5,7 @@ import {
NoValue,
} from '@folio/stripes/components';
+import { isEmpty } from 'lodash';
import { RECORD_ACTION_STATUS_LABEL_IDS } from '../../../utils';
import sharedCss from '../../../shared.css';
@@ -42,17 +43,19 @@ export const getRecordActionStatusLabel = recordType => {
return
;
};
-export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
+const renderNoValues = (itemData, isErrorColumn) => {
const itemsInfoCell = itemData?.map((sortedItems, itemIndex) => {
- const groupOfItems = sortedItems?.map((item, index) => (
-
-
- {item.error && isErrorColumn ? : null}
- {!isErrorColumn ? : null}
-
-
-
- ));
+ const groupOfItems = sortedItems?.map((item, index) => {
+ return (
+
+
+ {item.error && isErrorColumn ? : null}
+ {!isErrorColumn ? : null}
+
+
+
+ );
+ });
return
{groupOfItems}
;
});
@@ -63,3 +66,11 @@ export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
);
};
+
+export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
+ if (isEmpty(itemData)) {
+ return
;
+ }
+
+ return renderNoValues(itemData, isErrorColumn);
+};
From 5bd6911cd31236c301bdceb7dad9a4d9b78cfae7 Mon Sep 17 00:00:00 2001
From: Mariia Aloshyna
Date: Fri, 4 Aug 2023 14:35:01 +0300
Subject: [PATCH 09/14] Revert "UIDATIMP-1443: Improve mapping profile for
Holdings for handling multiple Holdings mapping (#1436)"
This reverts commit e360d19a258560a940ffcbf442cec76fd8fc05bd.
---
CHANGELOG.md | 1 -
.../edit/HoldingsDetailsSections/Location.js | 41 ++++++-------------
.../view/HoldingsDetailsSections/Location.js | 6 +--
.../initialDetails/HOLDINGS.js | 23 ++---------
.../MappingProfiles/initialDetails/index.js | 13 +++---
5 files changed, 22 insertions(+), 62 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8611f8724..d2c4b12cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,7 +14,6 @@
* Update Log details screen to support multiple holdings & items (UIDATIMP-1438)
* Update Log JSON screen to support multiple holdings (UIDATIMP-1439)
* Update Log JSON screen to support multiple items (UIDATIMP-1440)
-* Improve mapping profile for Holdings for handling multiple Holdings mapping (UIDATIMP-1443)
* DI Log: change Discarded to No action (UIDATIMP-1446)
* DI Log: Make some changes to the Log header (UIDATIMP-1447)
* DI Job profiles: Redirect when job profile was deleted (UIDATIMP-1450)
diff --git a/src/settings/MappingProfiles/detailsSections/edit/HoldingsDetailsSections/Location.js b/src/settings/MappingProfiles/detailsSections/edit/HoldingsDetailsSections/Location.js
index cbf2d335f..775111aea 100644
--- a/src/settings/MappingProfiles/detailsSections/edit/HoldingsDetailsSections/Location.js
+++ b/src/settings/MappingProfiles/detailsSections/edit/HoldingsDetailsSections/Location.js
@@ -19,8 +19,6 @@ import {
import {
getAcceptedValuesPath,
getFieldName,
- getRepeatableAcceptedValuesPath,
- getSubfieldName,
renderFieldLabelWithInfo,
} from '../../utils';
import {
@@ -32,21 +30,6 @@ export const Location = ({
setReferenceTables,
okapi,
}) => {
- const LOCATION_FIELDS_MAP = {
- PERMANENT: getSubfieldName(6, 0, 0),
- PERMANENT_ACCEPTED_VALUES: getRepeatableAcceptedValuesPath(6, 0, 0),
- TEMPORARY: getFieldName(7),
- TEMPORARY_ACCEPTED_VALUES: getAcceptedValuesPath(7),
- SHELVING_ORDER: getFieldName(8),
- SHELVING_TITLE: getFieldName(9),
- COPY_NUMBER: getFieldName(10),
- CALL_NUMBER_TYPE: getFieldName(11),
- CALL_NUMBER_TYPE_ACCEPTED_VALUES: getAcceptedValuesPath(11),
- CALL_NUMBER_PREFIX: getFieldName(12),
- CALL_NUMBER: getFieldName(13),
- CALL_NUMBER_SUFFIX: getFieldName(14),
- };
-
const permanentLocationLabel = renderFieldLabelWithInfo(
`${TRANSLATION_ID_PREFIX}.location.field.permanent`,
`${TRANSLATION_ID_PREFIX}.item.requiredWhenCreatingHoldings.info`,
@@ -64,7 +47,7 @@ export const Location = ({
>
@@ -85,7 +68,7 @@ export const Location = ({
>
}
optionValue="name"
optionLabel="name"
@@ -96,7 +79,7 @@ export const Location = ({
}]}
isRemoveValueAllowed
setAcceptedValues={setReferenceTables}
- acceptedValuesPath={LOCATION_FIELDS_MAP.TEMPORARY_ACCEPTED_VALUES}
+ acceptedValuesPath={getAcceptedValuesPath(7)}
optionTemplate="**name** (**code**)"
okapi={okapi}
/>
@@ -109,7 +92,7 @@ export const Location = ({
>
}
disabled
/>
@@ -122,7 +105,7 @@ export const Location = ({
{validation => (
}
validate={[validation]}
/>
@@ -139,7 +122,7 @@ export const Location = ({
{validation => (
}
validate={[validation]}
/>
@@ -154,7 +137,7 @@ export const Location = ({
>
}
optionValue="name"
optionLabel="name"
@@ -165,7 +148,7 @@ export const Location = ({
}]}
isRemoveValueAllowed
setAcceptedValues={setReferenceTables}
- acceptedValuesPath={LOCATION_FIELDS_MAP.CALL_NUMBER_TYPE_ACCEPTED_VALUES}
+ acceptedValuesPath={getAcceptedValuesPath(11)}
okapi={okapi}
/>
@@ -177,7 +160,7 @@ export const Location = ({
{validation => (
}
validate={[validation]}
/>
@@ -192,7 +175,7 @@ export const Location = ({
{validation => (
}
validate={[validation]}
/>
@@ -208,7 +191,7 @@ export const Location = ({
{validation => (
}
validate={[validation]}
/>
diff --git a/src/settings/MappingProfiles/detailsSections/view/HoldingsDetailsSections/Location.js b/src/settings/MappingProfiles/detailsSections/view/HoldingsDetailsSections/Location.js
index 2ac523446..c07c5f7b4 100644
--- a/src/settings/MappingProfiles/detailsSections/view/HoldingsDetailsSections/Location.js
+++ b/src/settings/MappingProfiles/detailsSections/view/HoldingsDetailsSections/Location.js
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
-import { get } from 'lodash';
import {
Accordion,
@@ -10,15 +9,14 @@ import {
KeyValue,
} from '@folio/stripes/components';
-import { ProhibitionIcon } from '../../../../../components';
+import { ProhibitionIcon } from '../../../../../components/ProhibitionIcon';
import { getFieldValue } from '../../utils';
import { TRANSLATION_ID_PREFIX } from '../../constants';
import { mappingProfileFieldShape } from '../../../../../utils';
export const Location = ({ mappingDetails }) => {
- const permanentLocationSubfields = getFieldValue(mappingDetails, 'permanentLocationId', 'subfields');
- const permanentLocation = get(permanentLocationSubfields, '[0].fields[0].value', '');
+ const permanentLocation = getFieldValue(mappingDetails, 'permanentLocationId', 'value');
const temporaryLocation = getFieldValue(mappingDetails, 'temporaryLocationId', 'value');
const shelvingOrder = getFieldValue(mappingDetails, 'shelvingOrder', 'value');
const shelvingTitle = getFieldValue(mappingDetails, 'shelvingTitle', 'value');
diff --git a/src/settings/MappingProfiles/initialDetails/HOLDINGS.js b/src/settings/MappingProfiles/initialDetails/HOLDINGS.js
index 250e486e7..34075788a 100644
--- a/src/settings/MappingProfiles/initialDetails/HOLDINGS.js
+++ b/src/settings/MappingProfiles/initialDetails/HOLDINGS.js
@@ -69,27 +69,10 @@ const HOLDINGS = {
}, {
name: 'permanentLocationId',
enabled: true,
- required: false,
- path: 'holdings.permanentLocationId[]',
+ path: 'holdings.permanentLocationId',
value: '',
- repeatableFieldAction: 'EXTEND_EXISTING',
- subfields: [
- {
- order: 0,
- path: 'holdings.permanentLocationId[]',
- fields: [
- {
- name: 'permanentLocationId',
- enabled: true,
- required: false,
- path: 'holdings.permanentLocationId[]',
- value: '',
- subfields: [],
- acceptedValues: {},
- },
- ],
- },
- ],
+ subfields: [],
+ acceptedValues: {},
}, {
name: 'temporaryLocationId',
enabled: true,
diff --git a/src/settings/MappingProfiles/initialDetails/index.js b/src/settings/MappingProfiles/initialDetails/index.js
index b4d596ec0..0d978c615 100644
--- a/src/settings/MappingProfiles/initialDetails/index.js
+++ b/src/settings/MappingProfiles/initialDetails/index.js
@@ -24,11 +24,6 @@ const initialValues = {
MARC_AUTHORITY,
};
-const KEEP_SUBFIELDS_INITIAL = {
- [FOLIO_RECORD_TYPES.INVOICE.type]: ['acqUnitIds'],
- [FOLIO_RECORD_TYPES.HOLDINGS.type]: ['permanentLocationId'],
-};
-
const modifyInvoiceLinesFieldDetails = field => {
const invoiceLineSubfield = { ...field.subfields[0] };
@@ -103,13 +98,15 @@ export const getInitialDetails = (entity, stripRepeatableFields = false) => {
if (field.name === 'invoiceLines') {
return modifyInvoiceLinesFieldDetails(field);
}
- }
- const keepSubfieldsInitial = KEEP_SUBFIELDS_INITIAL[entity]?.some(fieldName => fieldName === field.name);
+ if (field.name === 'acqUnitIds') {
+ return field;
+ }
+ }
return {
...field,
- subfields: keepSubfieldsInitial ? field.subfields : [],
+ subfields: [],
};
});
From 8c218c22877b4117fc695e815f13fa3bfd5cf258 Mon Sep 17 00:00:00 2001
From: Oleksandr Hladchenko1
Date: Mon, 7 Aug 2023 10:15:37 +0300
Subject: [PATCH 10/14] multiple-feature: Add general items error displaying
---
.../JobSummary/components/RecordsTable.js | 56 +++++++++++++++----
.../components/cells/HoldingsCell.js | 2 +-
.../JobSummary/components/cells/ItemCell.js | 2 +-
src/routes/JobSummary/components/utils.js | 18 +++++-
4 files changed, 65 insertions(+), 13 deletions(-)
diff --git a/src/routes/JobSummary/components/RecordsTable.js b/src/routes/JobSummary/components/RecordsTable.js
index c62f0b42f..9471723f5 100644
--- a/src/routes/JobSummary/components/RecordsTable.js
+++ b/src/routes/JobSummary/components/RecordsTable.js
@@ -30,7 +30,8 @@ import {
InvoiceCell,
ErrorCell,
} from '.';
-import { BaseLineCell } from './utils';
+import { BaseLineCell, isGeneralItemsError } from './utils';
+import { RECORD_ACTION_STATUS } from '../../../utils';
export const RecordsTable = ({
mutator,
@@ -103,6 +104,7 @@ export const RecordsTable = ({
invoiceStatus: ,
error: ,
};
+
const resultsFormatter = {
recordNumber: ({ sourceRecordOrder }) => (
;
- const itemInfo = [...sourceRecord?.relatedItemInfo];
+ const itemInfo = sourceRecord?.relatedItemInfo ? [...sourceRecord?.relatedItemInfo] : [{}];
const instanceId = sourceRecord?.relatedInstanceInfo.idList[0];
- holdingsInfo.forEach(holdings => {
- const isDiscarded = holdings.actionStatus === 'DISCARDED';
+ holdingsInfo?.forEach(holdings => {
+ const isDiscarded = holdings.actionStatus === RECORD_ACTION_STATUS.DISCARDED;
const holdingsId = holdings.id;
if (isDiscarded && !itemInfo.find(item => item.holdingsId === holdingsId)) {
@@ -168,16 +170,39 @@ export const RecordsTable = ({
/>
);
},
- itemStatus: ({ sourceRecordId }) => {
+ itemStatus: ({
+ sourceRecordId,
+ itemActionStatus,
+ }) => {
const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo;
+ const itemData = sourceRecord?.relatedItemInfo || [];
const instanceId = sourceRecord?.relatedInstanceInfo.idList[0];
- if (isEmpty(itemData) && isEmpty(holdingsData)) return ;
+ const isGeneralItemError = isGeneralItemsError(itemData, itemActionStatus);
+
+ if (isGeneralItemError) {
+ return (
+
+
+
+ );
+ }
+
+ if (isEmpty(itemData) && isEmpty(holdingsData)) {
+ return (
+
+
+
+ );
+ }
if (isEmpty(itemData)) {
- const emptyValues = holdingsData?.map((_, index) =>
);
+ const emptyValues = holdingsData?.map((_, index) => (
+
+
+
+ ));
return (
@@ -186,10 +211,10 @@ export const RecordsTable = ({
);
}
- const itemInfo = [...sourceRecord?.relatedItemInfo];
+ const itemInfo = sourceRecord?.relatedItemInfo ? [...sourceRecord?.relatedItemInfo] : [{}];
holdingsData.forEach(holdings => {
- const isDiscarded = holdings.actionStatus === 'DISCARDED';
+ const isDiscarded = holdings.actionStatus === RECORD_ACTION_STATUS.DISCARDED;
const holdingsId = holdings.id;
if (isDiscarded && !itemInfo.find(item => item.holdingsId === holdingsId)) {
@@ -278,11 +303,22 @@ export const RecordsTable = ({
error: ({
error,
sourceRecordId,
+ itemActionStatus,
}) => {
const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
const holdingsData = sourceRecord?.relatedHoldingsInfo;
const itemData = sourceRecord?.relatedItemInfo;
+ const isGeneralItemError = isGeneralItemsError(itemData, itemActionStatus);
+
+ if (isGeneralItemError) {
+ return (
+
+
+
+ );
+ }
+
if (isEmpty(itemData) && holdingsData?.some(item => item.error)) {
return (
locationId === locationItem.id)?.code;
diff --git a/src/routes/JobSummary/components/cells/ItemCell.js b/src/routes/JobSummary/components/cells/ItemCell.js
index 991b3d24d..5ad30ba8b 100644
--- a/src/routes/JobSummary/components/cells/ItemCell.js
+++ b/src/routes/JobSummary/components/cells/ItemCell.js
@@ -18,7 +18,7 @@ export const ItemCell = ({
const holdingsId = item.holdingsId;
const itemId = item.id;
const path = `/inventory/view/${instanceId}/${holdingsId}/${itemId}`;
- const isDiscarded = item.actionStatus === 'DISCARDED';
+ const isDiscarded = item.actionStatus === RECORD_ACTION_STATUS.DISCARDED;
const hrId = item.hrid;
diff --git a/src/routes/JobSummary/components/utils.js b/src/routes/JobSummary/components/utils.js
index efae29c99..5ecc4e654 100644
--- a/src/routes/JobSummary/components/utils.js
+++ b/src/routes/JobSummary/components/utils.js
@@ -6,7 +6,10 @@ import {
} from '@folio/stripes/components';
import { isEmpty } from 'lodash';
-import { RECORD_ACTION_STATUS_LABEL_IDS } from '../../../utils';
+import {
+ RECORD_ACTION_STATUS,
+ RECORD_ACTION_STATUS_LABEL_IDS,
+} from '../../../utils';
import sharedCss from '../../../shared.css';
@@ -74,3 +77,16 @@ export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
return renderNoValues(itemData, isErrorColumn);
};
+
+/*
+ When there is general item error, BE sends response like this
+ realtedItemInfo: [{
+ actionStatus: "DISCARDED",
+ error: "Error",
+ hrid: "",
+ }];
+ This array always contains one item with status 'DISCARDED' and nas no holdingsId.
+*/
+export const isGeneralItemsError = (itemData, itemStatus) => {
+ return itemData?.length === 1 && !itemData[0].holdingsId && itemStatus === RECORD_ACTION_STATUS.DISCARDED;
+};
From 5aefcd5e4c166e8327ecccd64ef081b1f23c06d2 Mon Sep 17 00:00:00 2001
From: Oleksandr Hladchenko1
Date: Mon, 7 Aug 2023 12:37:06 +0300
Subject: [PATCH 11/14] multiple-feature: Replace Error with No action
---
src/routes/JobSummary/components/RecordsTable.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/routes/JobSummary/components/RecordsTable.js b/src/routes/JobSummary/components/RecordsTable.js
index 9471723f5..8a6fe3924 100644
--- a/src/routes/JobSummary/components/RecordsTable.js
+++ b/src/routes/JobSummary/components/RecordsTable.js
@@ -184,7 +184,7 @@ export const RecordsTable = ({
if (isGeneralItemError) {
return (
-
+
);
}
From 474789f56f2fa78f12e9dc164dc4b20be3a090af Mon Sep 17 00:00:00 2001
From: Oleksandr Hladchenko1
Date: Mon, 7 Aug 2023 18:29:52 +0300
Subject: [PATCH 12/14] multiple-feature: refactor code
---
.../JobSummary/components/RecordsTable.js | 101 ++++++++++--------
src/routes/JobSummary/components/utils.js | 51 ++++++++-
2 files changed, 101 insertions(+), 51 deletions(-)
diff --git a/src/routes/JobSummary/components/RecordsTable.js b/src/routes/JobSummary/components/RecordsTable.js
index 8a6fe3924..0e6ab6423 100644
--- a/src/routes/JobSummary/components/RecordsTable.js
+++ b/src/routes/JobSummary/components/RecordsTable.js
@@ -1,7 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
-import { get, isEmpty, groupBy } from 'lodash';
+import {
+ get,
+ isEmpty,
+} from 'lodash';
import {
buildSortOrder,
@@ -30,7 +33,12 @@ import {
InvoiceCell,
ErrorCell,
} from '.';
-import { BaseLineCell, isGeneralItemsError } from './utils';
+import {
+ BaseLineCell,
+ getRelatedInfo,
+ groupAndSortDataForRender,
+ isGeneralItemsError,
+} from './utils';
import { RECORD_ACTION_STATUS } from '../../../utils';
export const RecordsTable = ({
@@ -143,15 +151,24 @@ export const RecordsTable = ({
/>
),
holdingsStatus: ({ sourceRecordId }) => {
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsInfo = sourceRecord?.relatedHoldingsInfo;
+ const {
+ instanceData,
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
- if (isEmpty(holdingsInfo)) return ;
+ if (isEmpty(holdingsData)) {
+ return (
+
+
+
+ );
+ }
- const itemInfo = sourceRecord?.relatedItemInfo ? [...sourceRecord?.relatedItemInfo] : [{}];
- const instanceId = sourceRecord?.relatedInstanceInfo.idList[0];
+ const itemInfo = itemData ? [...itemData] : [{}];
+ const instanceId = instanceData?.idList[0];
- holdingsInfo?.forEach(holdings => {
+ holdingsData?.forEach(holdings => {
const isDiscarded = holdings.actionStatus === RECORD_ACTION_STATUS.DISCARDED;
const holdingsId = holdings.id;
@@ -163,8 +180,7 @@ export const RecordsTable = ({
return (
@@ -174,10 +190,11 @@ export const RecordsTable = ({
sourceRecordId,
itemActionStatus,
}) => {
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo || [];
- const instanceId = sourceRecord?.relatedInstanceInfo.idList[0];
+ const {
+ instanceData,
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
const isGeneralItemError = isGeneralItemsError(itemData, itemActionStatus);
@@ -211,9 +228,10 @@ export const RecordsTable = ({
);
}
- const itemInfo = sourceRecord?.relatedItemInfo ? [...sourceRecord?.relatedItemInfo] : [{}];
+ const itemInfo = itemData ? [...itemData] : [{}];
+ const instanceId = instanceData?.idList[0];
- holdingsData.forEach(holdings => {
+ holdingsData?.forEach(holdings => {
const isDiscarded = holdings.actionStatus === RECORD_ACTION_STATUS.DISCARDED;
const holdingsId = holdings.id;
@@ -222,8 +240,7 @@ export const RecordsTable = ({
}
});
- const groupedItemData = groupBy(itemInfo, 'holdingsId');
- const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id]);
+ const sortedItemData = groupAndSortDataForRender(itemData, holdingsData);
return (
{
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo;
-
- const groupedItemData = groupBy(itemData, 'holdingsId');
+ const {
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
- const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id])
- .map(element => (!element ? [{}] : element));
+ const sortedItemData = groupAndSortDataForRender(itemData, holdingsData);
return (
{
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo;
+ const {
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
- const groupedItemData = groupBy(itemData, 'holdingsId');
-
- const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id])
- .map(element => (element || [{}]));
+ const sortedItemData = groupAndSortDataForRender(itemData, holdingsData);
return (
{
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo;
-
- const groupedItemData = groupBy(itemData, 'holdingsId');
+ const {
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
- const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id])
- .map(element => (element || [{}]));
+ const sortedItemData = groupAndSortDataForRender(itemData, holdingsData);
return (
{
- const sourceRecord = jobLogRecords.find(item => item.sourceRecordId === sourceRecordId);
- const holdingsData = sourceRecord?.relatedHoldingsInfo;
- const itemData = sourceRecord?.relatedItemInfo;
+ const {
+ holdingsData,
+ itemData,
+ } = getRelatedInfo(jobLogRecords, sourceRecordId);
const isGeneralItemError = isGeneralItemsError(itemData, itemActionStatus);
@@ -328,10 +340,7 @@ export const RecordsTable = ({
);
}
- const groupedItemData = groupBy(itemData, 'holdingsId');
-
- const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id])
- .map(element => (element || [{ error: true }]));
+ const sortedItemData = groupAndSortDataForRender(itemData, holdingsData, true);
return (
{children}
;
+export const BaseLineCell = ({ children }) => (
+
+ {children}
+
+);
export const getHotlinkCellFormatter = (isHotlink, entityLabel, path, entity) => {
if (isHotlink) {
@@ -43,7 +50,11 @@ export const getRecordActionStatusLabel = recordType => {
const labelId = RECORD_ACTION_STATUS_LABEL_IDS[recordType];
- return ;
+ return (
+
+
+
+ );
};
const renderNoValues = (itemData, isErrorColumn) => {
@@ -60,7 +71,11 @@ const renderNoValues = (itemData, isErrorColumn) => {
);
});
- return {groupOfItems}
;
+ return (
+
+ {groupOfItems}
+
+ );
});
return (
@@ -72,7 +87,11 @@ const renderNoValues = (itemData, isErrorColumn) => {
export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
if (isEmpty(itemData)) {
- return ;
+ return (
+
+
+
+ );
}
return renderNoValues(itemData, isErrorColumn);
@@ -90,3 +109,25 @@ export const fillCellWithNoValues = (itemData, isErrorColumn = false) => {
export const isGeneralItemsError = (itemData, itemStatus) => {
return itemData?.length === 1 && !itemData[0].holdingsId && itemStatus === RECORD_ACTION_STATUS.DISCARDED;
};
+
+export const getRelatedInfo = (jobLogRecords, sourceRecordId) => {
+ const sourceRecord = jobLogRecords?.find(item => item.sourceRecordId === sourceRecordId);
+ const instanceData = sourceRecord?.relatedInstanceInfo;
+ const holdingsData = sourceRecord?.relatedHoldingsInfo;
+ const itemData = sourceRecord?.relatedItemInfo;
+
+ return {
+ instanceData,
+ holdingsData,
+ itemData,
+ };
+};
+
+export const groupAndSortDataForRender = (itemData, holdingsData, isError = false) => {
+ const groupedItemData = groupBy(itemData, 'holdingsId');
+ const sortedItemData = holdingsData?.map(holdings => groupedItemData[holdings.id]);
+
+ return isError
+ ? sortedItemData?.map(element => (element || [{ error: true }]))
+ : sortedItemData?.map(element => (element || [{}]));
+};
From 991788c5fce14fe1f349e90015531a73ef479755 Mon Sep 17 00:00:00 2001
From: Oleksandr Hladchenko1
Date: Mon, 7 Aug 2023 18:42:18 +0300
Subject: [PATCH 13/14] multiple-feature: fix code smells
---
src/hooks/tests/useLocationsQuery.test.js | 5 ++++-
src/routes/JobSummary/components/cells/ErrorCell.js | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/hooks/tests/useLocationsQuery.test.js b/src/hooks/tests/useLocationsQuery.test.js
index 97137047c..d37b6bf76 100644
--- a/src/hooks/tests/useLocationsQuery.test.js
+++ b/src/hooks/tests/useLocationsQuery.test.js
@@ -22,7 +22,10 @@ describe('useLocationsQuery', () => {
});
it('should fetch locations', async () => {
- const { result, waitFor } = renderHook(() => useLocationsQuery(), { wrapper: queryClientWrapper });
+ const {
+ result,
+ waitFor,
+ } = renderHook(() => useLocationsQuery(), { wrapper: queryClientWrapper });
await waitFor(() => !result.current.isLoading);
diff --git a/src/routes/JobSummary/components/cells/ErrorCell.js b/src/routes/JobSummary/components/cells/ErrorCell.js
index 92c898926..136210c8a 100644
--- a/src/routes/JobSummary/components/cells/ErrorCell.js
+++ b/src/routes/JobSummary/components/cells/ErrorCell.js
@@ -2,7 +2,10 @@ import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';
-import { BaseLineCell, fillCellWithNoValues } from '../utils';
+import {
+ BaseLineCell,
+ fillCellWithNoValues,
+} from '../utils';
export const ErrorCell = ({
error,
From dcc5f4642c8fd1ef69ec520e7cc774ed75f2135d Mon Sep 17 00:00:00 2001
From: Oleksandr Hladchenko1
Date: Tue, 8 Aug 2023 19:34:10 +0300
Subject: [PATCH 14/14] multiple-feature: fixes after review
---
src/routes/JobSummary/JobSummary.js | 3 +-
.../components/RecordsTable.test.js | 148 +++++++++---------
.../cells/tests/AuthorityCell.test.js | 32 ++--
.../components/cells/tests/ErrorCell.test.js | 14 +-
.../cells/tests/HoldingsCell.test.js | 26 +--
.../cells/tests/InstanceCell.test.js | 4 +-
.../cells/tests/InvoiceCell.test.js | 20 +--
.../components/cells/tests/ItemCell.test.js | 16 +-
.../components/cells/tests/OrderCell.test.js | 32 ++--
9 files changed, 148 insertions(+), 147 deletions(-)
diff --git a/src/routes/JobSummary/JobSummary.js b/src/routes/JobSummary/JobSummary.js
index e5a5338e3..d3374b30b 100644
--- a/src/routes/JobSummary/JobSummary.js
+++ b/src/routes/JobSummary/JobSummary.js
@@ -39,6 +39,7 @@ import {
DATA_TYPES,
storage,
PREVIOUS_LOCATIONS_KEY,
+ PER_REQUEST_LIMIT,
} from '../../utils';
const INITIAL_RESULT_COUNT = 100;
@@ -287,7 +288,7 @@ JobSummaryComponent.manifest = Object.freeze({
throwErrors: false,
type: 'okapi',
records: 'locations',
- path: 'locations?limit=1000&query=cql.allRecords=1 sortby name',
+ path: `locations?limit=${PER_REQUEST_LIMIT}&query=cql.allRecords=1 sortby name`,
}
});
diff --git a/src/routes/JobSummary/components/RecordsTable.test.js b/src/routes/JobSummary/components/RecordsTable.test.js
index 199812672..40ad3549f 100644
--- a/src/routes/JobSummary/components/RecordsTable.test.js
+++ b/src/routes/JobSummary/components/RecordsTable.test.js
@@ -46,111 +46,111 @@ const jobLogEntriesResources = {
};
const jobLogRecords = [{
- jobExecutionId : '467d7627-c0db-4fb7-b333-4b4983dbf781',
- sourceRecordId : '59138d56-bc81-4f66-9f72-f57f53621111',
+ jobExecutionId: '467d7627-c0db-4fb7-b333-4b4983dbf781',
+ sourceRecordId: '59138d56-bc81-4f66-9f72-f57f53621111',
sourceRecordOrder : 0,
- sourceRecordTitle : 'Test record 1',
- sourceRecordActionStatus : 'CREATED',
+ sourceRecordTitle: 'Test record 1',
+ sourceRecordActionStatus: 'CREATED',
instanceActionStatus: 'CREATED',
- error : '',
- relatedInstanceInfo : {
- actionStatus : 'CREATED',
- idList : ['720031b9-a792-4936-963c-a7b63fb96574'],
- hridList : ['in00000000014'],
- error : ''
+ error: '',
+ relatedInstanceInfo: {
+ actionStatus: 'CREATED',
+ idList: ['720031b9-a792-4936-963c-a7b63fb96574'],
+ hridList: ['in00000000014'],
+ error: '',
},
- relatedHoldingsInfo : [],
- relatedItemInfo : [],
+ relatedHoldingsInfo: [],
+ relatedItemInfo: [],
relatedAuthorityInfo: {
- idList : [],
- hridList : []
+ idList: [],
+ hridList: [],
},
relatedPoLineInfo: {
idList: [],
- hridList : []
+ hridList: [],
},
- relatedInvoiceInfo : {
- idList : [],
- hridList : []
+ relatedInvoiceInfo: {
+ idList: [],
+ hridList: [],
},
- relatedInvoiceLineInfo : { }
+ relatedInvoiceLineInfo: { },
}, {
- jobExecutionId : '467d7627-c0db-4fb7-b333-4b4983dbf781',
- sourceRecordId : '59138d56-bc81-4f66-9f72-f57f53629646',
+ jobExecutionId: '467d7627-c0db-4fb7-b333-4b4983dbf781',
+ sourceRecordId: '59138d56-bc81-4f66-9f72-f57f53629646',
sourceRecordOrder : 4,
- sourceRecordTitle : 'Test record 2',
- sourceRecordActionStatus : 'CREATED',
+ sourceRecordTitle: 'Test record 2',
+ sourceRecordActionStatus: 'CREATED',
instanceActionStatus: 'CREATED',
- error : '',
- relatedInstanceInfo : {
- actionStatus : 'CREATED',
- idList : ['720031b9-a792-4936-963c-a7b63fb96574'],
- hridList : ['in00000000014'],
- error : ''
+ error: '',
+ relatedInstanceInfo: {
+ actionStatus: 'CREATED',
+ idList: ['720031b9-a792-4936-963c-a7b63fb96574'],
+ hridList: ['in00000000014'],
+ error: '',
},
- relatedHoldingsInfo : [{
- actionStatus : 'CREATED',
- id : 'f648c370-d9d6-432c-a502-b8eb718f867c',
+ relatedHoldingsInfo: [{
+ actionStatus: 'CREATED',
+ id: 'f648c370-d9d6-432c-a502-b8eb718f867c',
permanentLocationId: '53cf956f-c1df-410b-8bea-27f712cca7c0',
- hrid : 'ho00000000017',
- error : ''
+ hrid: 'ho00000000017',
+ error: '',
}, {
actionStatus: 'CREATED',
- id : '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
+ id: '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
permanentLocationId: '758258bc-ecc1-41b8-abca-f7b610822ffd',
- hrid : 'ho00000000018',
- error : ''
+ hrid: 'ho00000000018',
+ error: '',
}, {
- actionStatus : 'DISCARDED',
- id : '5cadf17f-eb72-475c-a2e0-7e56f54fd3b4',
+ actionStatus: 'DISCARDED',
+ id: '5cadf17f-eb72-475c-a2e0-7e56f54fd3b4',
permanentLocationId: 'fcd64ce1-6995-48f0-840e-89ffa2288371',
- hrid : 'ho00000000014',
- error : ''
+ hrid: 'ho00000000014',
+ error: '',
}],
- relatedItemInfo : [{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'f648c370-d9d6-432c-a502-b8eb718f867c',
- error : ''
+ relatedItemInfo: [{
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'f648c370-d9d6-432c-a502-b8eb718f867c',
+ error: '',
}, {
- actionStatus : 'DISCARDED',
- id : 'ccd19bf0-add1-46bb-899b-c457fd448b51',
- hrid : 'it00000000016',
- holdingsId : 'f648c370-d9d6-432c-a502-b8eb718f867c',
- error : 'test error'
+ actionStatus: 'DISCARDED',
+ id: 'ccd19bf0-add1-46bb-899b-c457fd448b51',
+ hrid: 'it00000000016',
+ holdingsId: 'f648c370-d9d6-432c-a502-b8eb718f867c',
+ error: 'test error',
}, {
- actionStatus : 'CREATED',
- id : 'ccd19bf0-add1-46bb-899b-c457fd441111',
- hrid : 'it00000000019',
- holdingsId : '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
- error : ''
+ actionStatus: 'CREATED',
+ id: 'ccd19bf0-add1-46bb-899b-c457fd441111',
+ hrid: 'it00000000019',
+ holdingsId: '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
+ error: '',
}, {
- actionStatus : 'CREATED',
- id : '3bcfe427-a747-405f-b3f3-1d842ffb2222',
- hrid : 'it00000000018',
- holdingsId : '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
- error : ''
+ actionStatus: 'CREATED',
+ id: '3bcfe427-a747-405f-b3f3-1d842ffb2222',
+ hrid: 'it00000000018',
+ holdingsId: '5cadf17f-eb72-475c-a2e0-7e56f54f0000',
+ error: '',
}, {
- actionStatus : 'CREATED',
- id : '3bcfe427-a747-405f-b3f3-1d842ffb49c6',
- hrid : 'it00000000014',
- holdingsId : 'f648c370-d9d6-432c-a502-b8eb718f867c',
- error : ''
+ actionStatus: 'CREATED',
+ id: '3bcfe427-a747-405f-b3f3-1d842ffb49c6',
+ hrid: 'it00000000014',
+ holdingsId: 'f648c370-d9d6-432c-a502-b8eb718f867c',
+ error: '',
}],
relatedAuthorityInfo: {
- idList : [],
- hridList : []
+ idList: [],
+ hridList: [],
},
relatedPoLineInfo: {
idList: [],
- hridList : []
+ hridList: [],
},
- relatedInvoiceInfo : {
- idList : [],
- hridList : []
+ relatedInvoiceInfo: {
+ idList: [],
+ hridList: [],
},
- relatedInvoiceLineInfo : { }
+ relatedInvoiceLineInfo: { },
}];
const jobLogResources = {
diff --git a/src/routes/JobSummary/components/cells/tests/AuthorityCell.test.js b/src/routes/JobSummary/components/cells/tests/AuthorityCell.test.js
index 82a50cab0..16c3b8af7 100644
--- a/src/routes/JobSummary/components/cells/tests/AuthorityCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/AuthorityCell.test.js
@@ -21,18 +21,18 @@ const jobLogRecords = [{
idList: [faker.random.uuid()],
},
relatedHoldingsInfo: [{
- actionStatus : 'CREATED',
- id : 'testHoldingsId',
+ actionStatus: 'CREATED',
+ id: 'testHoldingsId',
permanentLocationId: faker.random.uuid(),
- hrid : 'ho00000000017',
- error : ''
+ hrid: 'ho00000000017',
+ error: '',
}],
relatedItemInfo: [{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}],
relatedAuthorityInfo: {
actionStatus: 'CREATED',
@@ -46,11 +46,11 @@ const jobLogRecords = [{
const sortedItemData = [
[{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}]
];
@@ -77,7 +77,7 @@ describe('AuthorityCell component', () => {
});
describe('when authority was created', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderAuthorityCell('CREATED');
const authorityHotlink = container.querySelector('[data-test-entity-name="authority"]');
@@ -86,7 +86,7 @@ describe('AuthorityCell component', () => {
});
describe('when authority was updated', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderAuthorityCell('UPDATED');
const authorityHotlink = container.querySelector('[data-test-entity-name="authority"]');
diff --git a/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js b/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
index 0992ad755..5ab7f9fb3 100644
--- a/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/ErrorCell.test.js
@@ -12,11 +12,11 @@ import { ErrorCell } from '../ErrorCell';
const sortedItemDataProp = [
[{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : 'test error'
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: 'test error',
}]
];
@@ -39,14 +39,14 @@ describe('ErrorCell component', () => {
});
describe('when error was occured', () => {
- it('error message should be rendered', () => {
+ it('should render error message', () => {
const { getByText } = renderErrorCell({ error: 'test error' });
expect(getByText('Error')).toBeInTheDocument();
});
describe('when item has an error', () => {
- it('error message should be rendered', () => {
+ it('should render error message', () => {
const { getByText } = renderErrorCell({
error: 'test error',
sortedItemData: sortedItemDataProp,
diff --git a/src/routes/JobSummary/components/cells/tests/HoldingsCell.test.js b/src/routes/JobSummary/components/cells/tests/HoldingsCell.test.js
index 76b45b82d..fb1721e4a 100644
--- a/src/routes/JobSummary/components/cells/tests/HoldingsCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/HoldingsCell.test.js
@@ -12,25 +12,25 @@ import {
import { HoldingsCell } from '../HoldingsCell';
const locationsProp = [{
- id : 'testLocationId',
- name : 'Annex',
- code : 'KU/CC/DI/A',
+ id: 'testLocationId',
+ name: 'Annex',
+ code: 'KU/CC/DI/A',
}];
const holdingsInfoProp = (actionStatus = 'CREATED') => [{
actionStatus,
- id : 'testHoldingsId',
+ id: 'testHoldingsId',
permanentLocationId: 'testLocationId',
- hrid : 'ho00000000017',
- error : ''
+ hrid: 'ho00000000017',
+ error: '',
}];
const itemInfo = [{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}];
const renderHoldingsCell = (holdingsInfo) => {
@@ -56,7 +56,7 @@ describe('HoldingsCell component', () => {
});
describe('when holdings was created', () => {
- it('hotlink and location should be rendered', () => {
+ it('should render hotlink and location', () => {
const {
container,
getByText,
@@ -69,7 +69,7 @@ describe('HoldingsCell component', () => {
});
describe('when holdings was updated', () => {
- it('hotlink and location should be rendered', () => {
+ it('should render hotlink and location', () => {
const {
container,
getByText,
diff --git a/src/routes/JobSummary/components/cells/tests/InstanceCell.test.js b/src/routes/JobSummary/components/cells/tests/InstanceCell.test.js
index 1e35ea225..9f2b0a1eb 100644
--- a/src/routes/JobSummary/components/cells/tests/InstanceCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/InstanceCell.test.js
@@ -43,7 +43,7 @@ describe('InstanceCell component', () => {
});
describe('when instance was created', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderInstanceCell('CREATED');
const instanceHotlink = container.querySelector('[data-test-entity-name="instance"]');
@@ -52,7 +52,7 @@ describe('InstanceCell component', () => {
});
describe('when instance was updated', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderInstanceCell('UPDATED');
const instanceHotlink = container.querySelector('[data-test-entity-name="instance"]');
diff --git a/src/routes/JobSummary/components/cells/tests/InvoiceCell.test.js b/src/routes/JobSummary/components/cells/tests/InvoiceCell.test.js
index 5744f1b5f..405f8e6e7 100644
--- a/src/routes/JobSummary/components/cells/tests/InvoiceCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/InvoiceCell.test.js
@@ -15,24 +15,24 @@ const jobLogRecords = [{
sourceRecordId: 'testId',
sourceRecordOrder: 0,
invoiceActionStatus: 'CREATED',
- relatedInvoiceInfo : {
- idList : ['testInvoiceId'],
- hridList : []
+ relatedInvoiceInfo: {
+ idList: ['testInvoiceId'],
+ hridList: [],
},
relatedInvoiceLineInfo: {
fullInvoiceLineNumber: 0,
id: 'testInvoiceLineId',
- hridList : [],
+ hridList: [],
},
}];
const sortedItemData = [
[{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatu: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}]
];
@@ -60,7 +60,7 @@ describe('InvoiceCell component', () => {
});
describe('when invoice was created', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderInvoiceCell('CREATED');
const invoiceHotlink = container.querySelector('[data-test-entity-name="invoice"]');
diff --git a/src/routes/JobSummary/components/cells/tests/ItemCell.test.js b/src/routes/JobSummary/components/cells/tests/ItemCell.test.js
index 1fdbfea73..bbbff8a32 100644
--- a/src/routes/JobSummary/components/cells/tests/ItemCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/ItemCell.test.js
@@ -11,17 +11,17 @@ import {
import { ItemCell } from '../ItemCell';
-const sortedItemDataProp = (actionStatus) => [
+const sortedItemDataProp = actionStatus => [
[{
actionStatus,
- id : 'testItemId',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ id: 'testItemId',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}]
];
-const renderItemCell = (sortedItemData) => {
+const renderItemCell = sortedItemData => {
const component = (
{
});
describe('when item was created', () => {
- it('hotlink and hrid should be rendered', () => {
+ it('should render hotlink and hrid', () => {
const {
container,
getByText,
@@ -55,7 +55,7 @@ describe('ItemCell component', () => {
});
describe('when item was updated', () => {
- it('hotlink and location should be rendered', () => {
+ it('should render hotlink and hrid', () => {
const {
container,
getByText,
diff --git a/src/routes/JobSummary/components/cells/tests/OrderCell.test.js b/src/routes/JobSummary/components/cells/tests/OrderCell.test.js
index 7e5bdb2bb..0589d65cc 100644
--- a/src/routes/JobSummary/components/cells/tests/OrderCell.test.js
+++ b/src/routes/JobSummary/components/cells/tests/OrderCell.test.js
@@ -21,18 +21,18 @@ const jobLogRecords = [{
idList: [faker.random.uuid()],
},
relatedHoldingsInfo: [{
- actionStatus : 'CREATED',
- id : 'testHoldingsId',
+ actionStatus: 'CREATED',
+ id: 'testHoldingsId',
permanentLocationId: faker.random.uuid(),
- hrid : 'ho00000000017',
- error : ''
+ hrid: 'ho00000000017',
+ error: '',
}],
relatedItemInfo: [{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}],
relatedPoLineInfo: {
actionStatus: 'CREATED',
@@ -42,15 +42,15 @@ const jobLogRecords = [{
const sortedItemData = [
[{
- actionStatus : 'CREATED',
- id : '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
- hrid : 'it00000000015',
- holdingsId : 'testHoldingsId',
- error : ''
+ actionStatus: 'CREATED',
+ id: '37f20cb1-f60c-4195-80a1-00a16c4af5cb',
+ hrid: 'it00000000015',
+ holdingsId: 'testHoldingsId',
+ error: '',
}]
];
-const renderOrderCell = (poLineActionStatus) => {
+const renderOrderCell = poLineActionStatus => {
const component = (
{
});
describe('when order was created', () => {
- it('hotlink should be rendered', () => {
+ it('should render hotlink', () => {
const { container } = renderOrderCell('CREATED');
const orderHotlink = container.querySelector('[data-test-entity-name="order"]');