From 60667ebc42cfbb16718a124a3d5a3028017e2785 Mon Sep 17 00:00:00 2001 From: Dmytro-Melnyshyn Date: Tue, 24 Oct 2023 14:43:00 +0300 Subject: [PATCH 1/3] UIIN-2636: Replace imports from quick-marc with stripes-marc-components. --- CHANGELOG.md | 1 + package.json | 3 ++- src/components/ViewSource/ViewSource.js | 8 +++++--- src/components/ViewSource/ViewSource.test.js | 10 +++++----- test/jest/__mock__/index.js | 2 +- test/jest/__mock__/quickMarc.mock.js | 10 ---------- test/jest/__mock__/stripesMarcComponents.mock.js | 13 +++++++++++++ 7 files changed, 27 insertions(+), 20 deletions(-) delete mode 100644 test/jest/__mock__/quickMarc.mock.js create mode 100644 test/jest/__mock__/stripesMarcComponents.mock.js diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e12fcb6..ad087f93d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [10.1.0] IN PROGRESS +* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636. ## [10.0.1] IN PROGRESS diff --git a/package.json b/package.json index 4dc9374e4..80f95a193 100644 --- a/package.json +++ b/package.json @@ -862,6 +862,7 @@ "@folio/stripes-components": "^12.0.0", "@folio/stripes-connect": "^9.0.0", "@folio/stripes-core": "^10.0.0", + "@folio/stripes-marc-components": "^1.0.0", "@folio/stripes-smart-components": "^9.0.0", "@folio/stripes-testing": "^4.6.0", "@folio/stripes-util": "^6.0.0", @@ -882,7 +883,6 @@ "zustand": "^4.1.1" }, "dependencies": { - "@folio/quick-marc": "^7.0.0", "@folio/stripes-acq-components": "^5.0.0", "classnames": "^2.3.2", "file-saver": "^2.0.0", @@ -904,6 +904,7 @@ }, "peerDependencies": { "@folio/stripes": "^9.0.0", + "@folio/stripes-marc-components": "^1.0.0", "react": "^18.2.0", "react-intl": "^6.4.4", "react-query": "^3.6.0", diff --git a/src/components/ViewSource/ViewSource.js b/src/components/ViewSource/ViewSource.js index ce8fa5cae..57fab5307 100644 --- a/src/components/ViewSource/ViewSource.js +++ b/src/components/ViewSource/ViewSource.js @@ -10,9 +10,11 @@ import { LoadingView, } from '@folio/stripes/components'; import { useStripes } from '@folio/stripes/core'; -import MarcView from '@folio/quick-marc/src/QuickMarcView/QuickMarcView'; -import PrintPopup from '@folio/quick-marc/src/QuickMarcView/PrintPopup'; -import { getHeaders } from '@folio/quick-marc/src/QuickMarcEditor/utils'; +import { + MarcView, + PrintPopup, + getHeaders, +} from '@folio/stripes-marc-components'; import { useGoBack } from '../../common/hooks'; diff --git a/src/components/ViewSource/ViewSource.test.js b/src/components/ViewSource/ViewSource.test.js index a3777ab79..a719b9381 100644 --- a/src/components/ViewSource/ViewSource.test.js +++ b/src/components/ViewSource/ViewSource.test.js @@ -89,18 +89,18 @@ describe('ViewSource', () => { }); }); - it('should render QuickMarcView', () => { - expect(screen.getByText('QuickMarcView')).toBeInTheDocument(); + it('should render MarcView', () => { + expect(screen.getByText('MarcView')).toBeInTheDocument(); }); it('should initiate useGoBack with correct path', () => { expect(useGoBack).toBeCalledWith('/inventory/view/instance-id'); }); - describe('when QuickMarcView is closed', () => { + describe('when MarcView is closed', () => { it('should call onClose with correct url', async () => { - await waitFor(() => expect(screen.getByText('QuickMarcView')).toBeInTheDocument()); - act(() => fireEvent.click(screen.getByText('QuickMarcView'))); + await waitFor(() => expect(screen.getByText('MarcView')).toBeInTheDocument()); + act(() => fireEvent.click(screen.getByText('MarcView'))); expect(mockGoBack).toBeCalledTimes(1); }); }); diff --git a/test/jest/__mock__/index.js b/test/jest/__mock__/index.js index b75a3ae37..cb1422de0 100644 --- a/test/jest/__mock__/index.js +++ b/test/jest/__mock__/index.js @@ -6,7 +6,7 @@ import './stripesCore.mock'; import './stripesIcon.mock'; import './stripesSmartComponents.mock'; import './InstancePlugin.mock'; -import './quickMarc.mock'; +import './stripesMarcComponents.mock'; import './stripesComponents.mock'; import './reactBeautifulDnd.mock'; import './react-virtualized-auto-sizer'; diff --git a/test/jest/__mock__/quickMarc.mock.js b/test/jest/__mock__/quickMarc.mock.js deleted file mode 100644 index d38605f94..000000000 --- a/test/jest/__mock__/quickMarc.mock.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; - -jest.mock('@folio/quick-marc/src/QuickMarcView/QuickMarcView', () => ({ onClose, marcTitle }) => ( - <> - {marcTitle} - - -)); diff --git a/test/jest/__mock__/stripesMarcComponents.mock.js b/test/jest/__mock__/stripesMarcComponents.mock.js new file mode 100644 index 000000000..54761131f --- /dev/null +++ b/test/jest/__mock__/stripesMarcComponents.mock.js @@ -0,0 +1,13 @@ +import React from 'react'; + +jest.mock('@folio/stripes-marc-components', () => ({ + ...jest.requireActual('@folio/stripes-marc-components'), + MarcView: jest.fn(({ onClose, marcTitle }) => ( + <> + {marcTitle} + + + )), +})); From 9553e6bb8a3dfe0b071bab0483f02b74ffb3eeef Mon Sep 17 00:00:00 2001 From: Dmytro-Melnyshyn Date: Thu, 26 Oct 2023 16:19:14 +0300 Subject: [PATCH 2/3] bump version to 11.0.0 --- CHANGELOG.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad087f93d..3c73acce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ # Change history for ui-inventory -## [10.1.0] IN PROGRESS +## [11.0.0] IN PROGRESS -* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636. +* *BREAKING* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636. ## [10.0.1] IN PROGRESS diff --git a/package.json b/package.json index 80f95a193..1690b7162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/inventory", - "version": "10.1.0", + "version": "11.0.0", "description": "Inventory manager", "repository": "folio-org/ui-inventory", "publishConfig": { From f4b802e28fe5a9542c23737e032553e658ee479a Mon Sep 17 00:00:00 2001 From: Dmytro-Melnyshyn Date: Tue, 31 Oct 2023 18:11:37 +0200 Subject: [PATCH 3/3] fix tests --- test/jest/__mock__/stripesMarcComponents.mock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jest/__mock__/stripesMarcComponents.mock.js b/test/jest/__mock__/stripesMarcComponents.mock.js index 54761131f..ea3bf1551 100644 --- a/test/jest/__mock__/stripesMarcComponents.mock.js +++ b/test/jest/__mock__/stripesMarcComponents.mock.js @@ -6,7 +6,7 @@ jest.mock('@folio/stripes-marc-components', () => ({ <> {marcTitle} )),