From 31247b446bbf6028be78904465de085931ba44a3 Mon Sep 17 00:00:00 2001 From: Dmitriy-Litvinenko Date: Tue, 3 Sep 2024 16:26:56 +0300 Subject: [PATCH] UITEN-306: Fix saving problem for routing service point(ECS only) --- CHANGELOG.md | 1 + package.json | 1 + ...seCirculationSettingsEcsTlrFeature.test.js | 43 +++++++++++++++++++ .../ServicePointFormContainer.js | 1 + 4 files changed, 46 insertions(+) create mode 100644 src/hooks/useCirculationSettingsEcsTlrFeature/useCirculationSettingsEcsTlrFeature.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a7f27b..c0013201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ * [UITEN-299](https://folio-org.atlassian.net/browse/UITEN-299) Rewrite class components to functional ones (ui-tenant-settings module). * [UITEN-292](https://folio-org.atlassian.net/browse/UITEN-292) Change visibility rules for routing service points. * [UITEN-304](https://folio-org.atlassian.net/browse/UITEN-304) Provide case insensitive sorted data to edit record, field components. +* [UITEN-306](https://folio-org.atlassian.net/browse/UITEN-306) Fix saving problem for routing service point(ECS only). ## [8.1.0](https://github.com/folio-org/ui-tenant-settings/tree/v8.1.0)(2024-03-19) [Full Changelog](https://github.com/folio-org/ui-tenant-settings/compare/v8.0.0...v8.1.0) diff --git a/package.json b/package.json index 0201ceb0..ce71eac7 100644 --- a/package.json +++ b/package.json @@ -261,6 +261,7 @@ "@testing-library/dom": "^7.26.3", "@testing-library/jest-dom": "^5.11.1", "@testing-library/react": "^11.0.2", + "@testing-library/react-hooks": "^7.0.1", "@testing-library/user-event": "^12.1.10", "babel-eslint": "^9.0.0", "babel-jest": "^26.3.0", diff --git a/src/hooks/useCirculationSettingsEcsTlrFeature/useCirculationSettingsEcsTlrFeature.test.js b/src/hooks/useCirculationSettingsEcsTlrFeature/useCirculationSettingsEcsTlrFeature.test.js new file mode 100644 index 00000000..3068bf86 --- /dev/null +++ b/src/hooks/useCirculationSettingsEcsTlrFeature/useCirculationSettingsEcsTlrFeature.test.js @@ -0,0 +1,43 @@ +import { + QueryClient, + QueryClientProvider, +} from 'react-query'; +import { + renderHook, + act, +} from '@testing-library/react-hooks'; + +import { useOkapiKy } from '@folio/stripes/core'; + +import useCirculationSettingsEcsTlrFeature from './useCirculationSettingsEcsTlrFeature'; + +const queryClient = new QueryClient(); + +// eslint-disable-next-line react/prop-types +const wrapper = ({ children }) => ( + + {children} + +); + +const data = 'data'; + +describe('useCirculationSettingsEcsTlrFeature', () => { + it('should fetch data', async () => { + useOkapiKy.mockClear().mockReturnValue({ + get: () => ({ + json: () => ({ + data, + }), + }), + }); + + const { result } = renderHook(() => useCirculationSettingsEcsTlrFeature(true), { wrapper }); + + await act(() => { + return !result.current.isLoading; + }); + + expect(result.current.titleLevelRequestsFeatureEnabled).toBeFalsy(); + }); +}); diff --git a/src/settings/ServicePoints/ServicePointFormContainer.js b/src/settings/ServicePoints/ServicePointFormContainer.js index a4000b23..ec66497a 100644 --- a/src/settings/ServicePoints/ServicePointFormContainer.js +++ b/src/settings/ServicePoints/ServicePointFormContainer.js @@ -63,6 +63,7 @@ const ServicePointFormContainer = ({ } if (data.ecsRequestRouting) { + unset(data, 'shelvingLagTime'); unset(data, 'pickupLocation'); unset(data, 'holdShelfExpiryPeriod'); unset(data, 'holdShelfClosedLibraryDateManagement');