diff --git a/CHANGELOG.md b/CHANGELOG.md
index 09f76c69..a1b18eea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
## [11.1.0] IN PROGRESS
* Migrate from `mod-circulation` to `mod-circulation-bff` for `Print pick slips` and `Print search slips`. Refs UIREQ-1154.
+* Add optional column "Retrieval service point" to requests search list. Refs UIREQ-1188.
+* Increase code coverage for src/ChooseRequestTypeDialog.js by Jest/RTL tests. Refs UIREQ-1044.
* Add "Retrieval service point" filter. Refs UIREQ-1190.
## [11.0.1] (https://github.com/folio-org/ui-requests/tree/v11.0.1) (2024-12-02)
diff --git a/src/ChooseRequestTypeDialog.js b/src/ChooseRequestTypeDialog.js
index 02ddabd2..c95ccb65 100644
--- a/src/ChooseRequestTypeDialog.js
+++ b/src/ChooseRequestTypeDialog.js
@@ -81,6 +81,7 @@ class ChooseRequestTypeDialog extends React.Component {
{isLoading ?
:
}
name="requestType"
onChange={this.selectRequestType}
diff --git a/src/ChooseRequestTypeDialog.test.js b/src/ChooseRequestTypeDialog.test.js
index f202281d..05363a73 100644
--- a/src/ChooseRequestTypeDialog.test.js
+++ b/src/ChooseRequestTypeDialog.test.js
@@ -1,6 +1,7 @@
import {
render,
screen,
+ fireEvent,
} from '@folio/jest-config-stripes/testing-library/react';
import { Button } from '@folio/stripes/components';
@@ -23,9 +24,12 @@ jest.mock('./utils', () => ({
const labelIds = {
chooseRequestType: 'ui-requests.moveRequest.chooseRequestType',
+ confirmButtonLabel: 'ui-requests.moveRequest.confirm',
+ requestTypeError: 'ui-requests.moveRequest.error.itemLevelRequest',
};
const testIds = {
loading: 'loading',
+ requestType: 'requestType',
};
describe('ChooseRequestTypeDialog', () => {
@@ -85,6 +89,38 @@ describe('ChooseRequestTypeDialog', () => {
it('should not render Loading component', () => {
expect(screen.queryByTestId(testIds.loading)).not.toBeInTheDocument();
});
+
+ it('should handle confirmation after changing request type', () => {
+ const requestType = screen.getByTestId(testIds.requestType);
+ const confirmButton = screen.getByText(labelIds.confirmButtonLabel);
+ const event = {
+ target: {
+ value: '',
+ },
+ };
+
+ fireEvent.change(requestType, event);
+ fireEvent.click(confirmButton);
+
+ expect(mockOnConfirm).toHaveBeenCalledWith(event.target.value);
+ });
+ });
+
+ describe('When request type is not provided', () => {
+ const props = {
+ ...defaultTestProps,
+ requestTypes: [],
+ };
+
+ beforeEach(() => {
+ render();
+ });
+
+ it('should render request type error', () => {
+ const requestTypeError = screen.getByText(labelIds.requestTypeError);
+
+ expect(requestTypeError).toBeInTheDocument();
+ });
});
describe('when isLoading is true', () => {
diff --git a/src/deprecated/routes/RequestsRoute/RequestsRoute.js b/src/deprecated/routes/RequestsRoute/RequestsRoute.js
index 8f25e6f3..441c34b3 100644
--- a/src/deprecated/routes/RequestsRoute/RequestsRoute.js
+++ b/src/deprecated/routes/RequestsRoute/RequestsRoute.js
@@ -265,6 +265,7 @@ export const getListFormatter = (
);
},
'requesterBarcode': rq => (rq.requester ? rq.requester.barcode : DEFAULT_FORMATTER_VALUE),
+ 'retrievalServicePoint': rq => get(rq, 'item.retrievalServicePointName', DEFAULT_FORMATTER_VALUE),
'requestStatus': rq => (requestStatusesTranslations[rq.status]
?
: ),
@@ -334,6 +335,7 @@ class RequestsRoute extends React.Component {
'requestStatus': 'status',
'servicePoint': 'searchIndex.pickupServicePointName',
'requesterBarcode': 'requester.barcode',
+ 'retrievalServicePoint': 'item.retrievalServicePointName',
'requestDate': 'requestDate',
'position': 'position/number',
'proxy': 'proxy',
@@ -1416,6 +1418,7 @@ class RequestsRoute extends React.Component {
servicePoint: ,
requester: ,
requesterBarcode: ,
+ retrievalServicePoint: ,
singlePrint: ,
proxy: ,
...(isViewPrintDetailsEnabled && {
@@ -1686,7 +1689,7 @@ class RequestsRoute extends React.Component {
resultIsSelected={this.resultIsSelected}
onFilterChange={this.handleFilterChange}
sortableColumns={['requestDate', 'title', 'year', 'itemBarcode', 'callNumber', 'type', 'requestStatus',
- 'position', 'servicePoint', 'requester', 'requesterBarcode', 'proxy', 'copies', 'printed']}
+ 'position', 'servicePoint', 'requester', 'requesterBarcode', 'retrievalServicePoint', 'proxy', 'copies', 'printed']}
pageAmount={100}
pagingType={MCLPagingTypes.PREV_NEXT}
/>
diff --git a/src/deprecated/routes/RequestsRoute/RequestsRoute.test.js b/src/deprecated/routes/RequestsRoute/RequestsRoute.test.js
index 76fb1d64..b835d017 100644
--- a/src/deprecated/routes/RequestsRoute/RequestsRoute.test.js
+++ b/src/deprecated/routes/RequestsRoute/RequestsRoute.test.js
@@ -1150,6 +1150,8 @@ describe('RequestsRoute', () => {
select: 'test value',
item: {
barcode: 'itemBarcode',
+ retrievalServicePointId: '3a40852d-49fd-4df2-a1f9-6e2641a6e91f',
+ retrievalServicePointName: 'Circ Desk 1',
},
position: 'position',
proxy: {},
@@ -1371,6 +1373,12 @@ describe('RequestsRoute', () => {
});
});
+ describe('retrieval service point', () => {
+ it('should return retrieval service point', () => {
+ expect(listFormatter.retrievalServicePoint(requestWithData)).toBe(requestWithData.item.retrievalServicePointName);
+ });
+ });
+
describe('when formatting copies column', () => {
it('should return copies for copies column', () => {
expect(listFormatter.copies(requestWithData)).toBe(requestWithData.printDetails.printCount);
diff --git a/test/jest/__mock__/stripesComponents.mock.js b/test/jest/__mock__/stripesComponents.mock.js
index 7e2ec9d1..a42a860f 100644
--- a/test/jest/__mock__/stripesComponents.mock.js
+++ b/test/jest/__mock__/stripesComponents.mock.js
@@ -180,6 +180,7 @@ jest.mock('@folio/stripes/components', () => ({
+ {props.error}
)),
TextArea: jest.fn(({
'data-testid': testId,