From 70974fc510447a1b3ea37483454341b191307646 Mon Sep 17 00:00:00 2001 From: Dmitriy-Litvinenko Date: Wed, 27 Sep 2023 15:25:03 +0300 Subject: [PATCH] UIREQ-996: Update Jest/RTL tests, remove outdated imports --- CHANGELOG.md | 1 + src/CancelRequestDialog.test.js | 2 -- src/ChooseRequestTypeDialog.test.js | 3 --- src/ItemDetail.test.js | 4 +--- src/ItemsDialog.test.js | 5 +---- src/MoveRequestManager.test.js | 2 -- src/PatronBlockModal.test.js | 2 -- src/PositionLink.test.js | 3 --- src/RequestForm.test.js | 7 ++---- src/RequestFormContainer.test.js | 4 +--- src/UserDetail.test.js | 2 -- src/UserForm.test.js | 1 + src/ViewRequest.test.js | 13 ++--------- .../ComponentToPrint/ComponentToPrint.test.js | 2 +- src/components/ErrorModal/ErrorModal.test.js | 3 --- .../FulfilmentPreference.test.js | 6 ++--- .../InstanceInformation.test.js | 5 ++--- .../ItemInformation/ItemInformation.test.js | 6 ++--- src/components/Loading/Loading.test.js | 2 -- .../LoadingButton/LoadingButton.test.js | 2 -- .../PrintButton/PrintButton.test.js | 6 ++--- .../PrintContent/PrintContent.test.js | 2 -- .../ReferredRecord/ReferredRecord.test.js | 2 -- .../RequestsFormShortcutsWrapper.test.js | 3 --- .../RequestInformation.test.js | 6 ++--- .../RequesterInformation.test.js | 3 ++- .../PickupServicePointFilter.test.js | 2 -- .../RequestLevelFilter/RequestLevelFilter.js | 1 + .../RequestLevelFilter.test.js | 19 +++------------- .../RequestsRouteShortcutsWrapper.test.js | 3 --- .../SortableList/DraggableRow.test.js | 1 - .../SortableList/SortableList.test.js | 2 -- .../TitleInformation/TitleInformation.test.js | 3 --- .../ViewRequestShortcutsWrapper.test.js | 3 --- src/routes/NoteCreateRoute.test.js | 8 +++++-- src/routes/NoteEditRoute.test.js | 2 -- src/routes/NoteViewRoute.test.js | 2 -- src/routes/RequestQueueRoute.test.js | 2 -- src/routes/RequestsRoute.test.js | 8 +++---- src/utils.test.js | 1 - src/views/RequestQueueView.test.js | 2 -- .../FulfillmentRequestsData.test.js | 3 --- src/views/components/ItemLink.test.js | 6 ++--- .../NotYetFilledRequestsData.test.js | 3 --- src/views/components/RequesterLink.test.js | 6 ++--- src/views/constants.test.js | 2 -- test/jest/__mock__/stripesComponents.mock.js | 22 ++++++++++++++----- 47 files changed, 56 insertions(+), 142 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f758c62f..7833bb84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Hide all actions except "Cancel Request" in Action menu and DCB item links (Pickup library). Refs UIREQ-1035. * Request Action - Create new option Print search slips. Refs UIREQ-1039. * Hide Actions menu on closed request of DCB Transaction. Refs UIREQ-1040. +* Update Jest/RTL tests, remove outdated imports. Refs UIREQ-996. ## [9.0.0](https://github.com/folio-org/ui-requests/tree/v9.0.0) (2023-10-12) [Full Changelog](https://github.com/folio-org/ui-requests/compare/v8.0.2...v9.0.0) diff --git a/src/CancelRequestDialog.test.js b/src/CancelRequestDialog.test.js index 6bc9feb8a..a0cc42ba5 100644 --- a/src/CancelRequestDialog.test.js +++ b/src/CancelRequestDialog.test.js @@ -4,8 +4,6 @@ import { screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import CancelRequestDialog from './CancelRequestDialog'; const labelIds = { diff --git a/src/ChooseRequestTypeDialog.test.js b/src/ChooseRequestTypeDialog.test.js index c0bcc7ebf..f202281db 100644 --- a/src/ChooseRequestTypeDialog.test.js +++ b/src/ChooseRequestTypeDialog.test.js @@ -1,11 +1,8 @@ -import React from 'react'; import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import { Button } from '@folio/stripes/components'; import { Loading } from './components'; diff --git a/src/ItemDetail.test.js b/src/ItemDetail.test.js index 4242fed17..7199b870d 100644 --- a/src/ItemDetail.test.js +++ b/src/ItemDetail.test.js @@ -1,13 +1,11 @@ -import React from 'react'; import { render, screen, within, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import ItemDetail from './ItemDetail'; + import { INVALID_REQUEST_HARDCODED_ID } from './constants'; jest.mock('react-router-dom', () => ({ diff --git a/src/ItemsDialog.test.js b/src/ItemsDialog.test.js index ed984cbd9..6cabf6cd6 100644 --- a/src/ItemsDialog.test.js +++ b/src/ItemsDialog.test.js @@ -1,11 +1,8 @@ -import React from 'react'; import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import { Modal, MultiColumnList, @@ -137,7 +134,7 @@ describe('ItemsDialog', () => { }); it('should render Modal', () => { - expect(Modal).toHaveBeenLastCalledWith( + expect(Modal).toHaveBeenCalledWith( expect.objectContaining({ 'data-test-move-request-modal': true, label: labelIds.selectItem, diff --git a/src/MoveRequestManager.test.js b/src/MoveRequestManager.test.js index 39ebc11c3..0629d5ffc 100644 --- a/src/MoveRequestManager.test.js +++ b/src/MoveRequestManager.test.js @@ -7,8 +7,6 @@ import { } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '../test/jest/__mock__'; - import MoveRequestManager from './MoveRequestManager'; import ItemsDialog from './ItemsDialog'; import ChooseRequestTypeDialog from './ChooseRequestTypeDialog'; diff --git a/src/PatronBlockModal.test.js b/src/PatronBlockModal.test.js index cb2bbc8db..a1ce644e4 100644 --- a/src/PatronBlockModal.test.js +++ b/src/PatronBlockModal.test.js @@ -5,8 +5,6 @@ import { fireEvent, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import { Modal } from '@folio/stripes/components'; import PatronBlockModal from './PatronBlockModal'; diff --git a/src/PositionLink.test.js b/src/PositionLink.test.js index 975987171..8ab209d45 100644 --- a/src/PositionLink.test.js +++ b/src/PositionLink.test.js @@ -1,4 +1,3 @@ -import React from 'react'; import { render, screen, @@ -8,8 +7,6 @@ import { requestStatuses, } from './constants'; -import '../test/jest/__mock__'; - import PositionLink from './PositionLink'; jest.mock('react-router-dom', () => ({ diff --git a/src/RequestForm.test.js b/src/RequestForm.test.js index 1bb87e7b2..04dc1c78f 100644 --- a/src/RequestForm.test.js +++ b/src/RequestForm.test.js @@ -1,6 +1,7 @@ -import React from 'react'; import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; +import { Field } from 'react-final-form'; + import { render, screen, @@ -9,10 +10,6 @@ import { waitFor, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - -import { Field } from 'react-final-form'; - import { Checkbox, CommandList, diff --git a/src/RequestFormContainer.test.js b/src/RequestFormContainer.test.js index 9c845aa4d..cc3e4b0ef 100644 --- a/src/RequestFormContainer.test.js +++ b/src/RequestFormContainer.test.js @@ -1,17 +1,15 @@ -import React from 'react'; import { Router, } from 'react-router-dom'; import { createMemoryHistory, } from 'history'; + import { render, act, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import RequestFormContainer from './RequestFormContainer'; import RequestForm from './RequestForm'; diff --git a/src/UserDetail.test.js b/src/UserDetail.test.js index a201b1b79..7f1e01032 100644 --- a/src/UserDetail.test.js +++ b/src/UserDetail.test.js @@ -4,8 +4,6 @@ import { cleanup, } from '@folio/jest-config-stripes/testing-library/react'; -import '../test/jest/__mock__'; - import { NoValue } from '@folio/stripes/components'; import UserDetail from './UserDetail'; diff --git a/src/UserForm.test.js b/src/UserForm.test.js index d9a5a0e05..6d5623eb4 100644 --- a/src/UserForm.test.js +++ b/src/UserForm.test.js @@ -2,6 +2,7 @@ import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; + import { ProxyManager } from '@folio/stripes/smart-components'; import UserForm from './UserForm'; diff --git a/src/ViewRequest.test.js b/src/ViewRequest.test.js index 56f579929..1687c4d24 100644 --- a/src/ViewRequest.test.js +++ b/src/ViewRequest.test.js @@ -1,14 +1,11 @@ -import React from 'react'; +import moment from 'moment-timezone'; + import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import moment from 'moment-timezone'; - -import '../test/jest/__mock__'; import { - Pane, CommandList, defaultKeyboardShortcuts, } from '@folio/stripes/components'; @@ -34,12 +31,6 @@ jest.mock('./UserDetail', () => jest.fn(() => null)); jest.mock('./CancelRequestDialog', () => jest.fn(() => null)); jest.mock('./PositionLink', () => jest.fn(() => null)); jest.mock('./components/TitleInformation', () => jest.fn(() => null)); -Pane.mockImplementation(({ children, actionMenu }) => ( -
- {children} - {actionMenu({ onToggle: jest.fn() })} -
-)); describe('ViewRequest', () => { const labelIds = { diff --git a/src/components/ComponentToPrint/ComponentToPrint.test.js b/src/components/ComponentToPrint/ComponentToPrint.test.js index 47eed41df..83f6fb4de 100644 --- a/src/components/ComponentToPrint/ComponentToPrint.test.js +++ b/src/components/ComponentToPrint/ComponentToPrint.test.js @@ -1,5 +1,5 @@ -import React from 'react'; import { Parser } from 'html-to-react'; + import { render, screen, diff --git a/src/components/ErrorModal/ErrorModal.test.js b/src/components/ErrorModal/ErrorModal.test.js index 10cab0df3..fb058e64c 100644 --- a/src/components/ErrorModal/ErrorModal.test.js +++ b/src/components/ErrorModal/ErrorModal.test.js @@ -1,4 +1,3 @@ -import React from 'react'; import { render, screen, @@ -7,8 +6,6 @@ import { import { runAxeTest } from '@folio/stripes-testing'; -import '../../../test/jest/__mock__'; - import ErrorModal from './ErrorModal'; describe('ErrorModal', () => { diff --git a/src/components/FulfilmentPreference/FulfilmentPreference.test.js b/src/components/FulfilmentPreference/FulfilmentPreference.test.js index 870252807..5981a398f 100644 --- a/src/components/FulfilmentPreference/FulfilmentPreference.test.js +++ b/src/components/FulfilmentPreference/FulfilmentPreference.test.js @@ -1,3 +1,5 @@ +import { FormattedMessage } from 'react-intl'; + import { render, screen, @@ -5,10 +7,6 @@ import { cleanup, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - -import { FormattedMessage } from 'react-intl'; - import FulfilmentPreference, { validate, } from './FulfilmentPreference'; diff --git a/src/components/InstanceInformation/InstanceInformation.test.js b/src/components/InstanceInformation/InstanceInformation.test.js index 56b10532b..0386507e3 100644 --- a/src/components/InstanceInformation/InstanceInformation.test.js +++ b/src/components/InstanceInformation/InstanceInformation.test.js @@ -1,4 +1,6 @@ import { useState } from 'react'; +import { Field } from 'react-final-form'; + import { render, screen, @@ -7,9 +9,6 @@ import { waitFor, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - -import { Field } from 'react-final-form'; import { Icon, TextField, diff --git a/src/components/ItemInformation/ItemInformation.test.js b/src/components/ItemInformation/ItemInformation.test.js index 44b94830c..167281838 100644 --- a/src/components/ItemInformation/ItemInformation.test.js +++ b/src/components/ItemInformation/ItemInformation.test.js @@ -1,4 +1,6 @@ import { useState } from 'react'; +import { Field } from 'react-final-form'; + import { render, screen, @@ -6,10 +8,6 @@ import { cleanup, waitFor, } from '@folio/jest-config-stripes/testing-library/react'; - -import '../../../test/jest/__mock__'; - -import { Field } from 'react-final-form'; import { Icon, TextField, diff --git a/src/components/Loading/Loading.test.js b/src/components/Loading/Loading.test.js index aa82389ed..435ef8ec2 100644 --- a/src/components/Loading/Loading.test.js +++ b/src/components/Loading/Loading.test.js @@ -3,8 +3,6 @@ import { screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { Layout } from '@folio/stripes/components'; import Loading from './Loading'; diff --git a/src/components/LoadingButton/LoadingButton.test.js b/src/components/LoadingButton/LoadingButton.test.js index 4ecf621a3..95473b12c 100644 --- a/src/components/LoadingButton/LoadingButton.test.js +++ b/src/components/LoadingButton/LoadingButton.test.js @@ -3,8 +3,6 @@ import { screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '__mock__'; - import { Button, Icon, diff --git a/src/components/PrintButton/PrintButton.test.js b/src/components/PrintButton/PrintButton.test.js index 56f8dc85e..0b8aeb330 100644 --- a/src/components/PrintButton/PrintButton.test.js +++ b/src/components/PrintButton/PrintButton.test.js @@ -1,12 +1,10 @@ +import ReactToPrint from 'react-to-print'; + import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - -import ReactToPrint from 'react-to-print'; - import PrintButton from './PrintButton'; const testIds = { diff --git a/src/components/PrintContent/PrintContent.test.js b/src/components/PrintContent/PrintContent.test.js index 0501a5112..16e4a51ca 100644 --- a/src/components/PrintContent/PrintContent.test.js +++ b/src/components/PrintContent/PrintContent.test.js @@ -4,8 +4,6 @@ import { cleanup, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import PrintContent from './PrintContent'; import ComponentToPrint from '../ComponentToPrint'; diff --git a/src/components/ReferredRecord/ReferredRecord.test.js b/src/components/ReferredRecord/ReferredRecord.test.js index a470c50f2..e880f2dfa 100644 --- a/src/components/ReferredRecord/ReferredRecord.test.js +++ b/src/components/ReferredRecord/ReferredRecord.test.js @@ -1,5 +1,3 @@ -import '../../../test/jest/__mock__'; - import { render, screen, diff --git a/src/components/RequestFormShortcutsWrapper/RequestsFormShortcutsWrapper.test.js b/src/components/RequestFormShortcutsWrapper/RequestsFormShortcutsWrapper.test.js index b4b937544..9898c08f5 100644 --- a/src/components/RequestFormShortcutsWrapper/RequestsFormShortcutsWrapper.test.js +++ b/src/components/RequestFormShortcutsWrapper/RequestsFormShortcutsWrapper.test.js @@ -1,8 +1,5 @@ -import React from 'react'; import { render } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { CommandList, defaultKeyboardShortcuts, diff --git a/src/components/RequestInformation/RequestInformation.test.js b/src/components/RequestInformation/RequestInformation.test.js index 6c97255e2..124f7d58f 100644 --- a/src/components/RequestInformation/RequestInformation.test.js +++ b/src/components/RequestInformation/RequestInformation.test.js @@ -1,4 +1,6 @@ import { useState } from 'react'; +import { Field } from 'react-final-form'; + import { render, screen, @@ -6,10 +8,6 @@ import { cleanup, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - -import { Field } from 'react-final-form'; - import { Select } from '@folio/stripes/components'; import RequestInformation, { diff --git a/src/components/RequesterInformation/RequesterInformation.test.js b/src/components/RequesterInformation/RequesterInformation.test.js index 39a8b5339..b3758b70d 100644 --- a/src/components/RequesterInformation/RequesterInformation.test.js +++ b/src/components/RequesterInformation/RequesterInformation.test.js @@ -1,4 +1,6 @@ import { useState } from 'react'; +import { Field } from 'react-final-form'; + import { render, screen, @@ -7,7 +9,6 @@ import { waitFor, } from '@folio/jest-config-stripes/testing-library/react'; -import { Field } from 'react-final-form'; import { Icon, TextField, diff --git a/src/components/RequestsFilters/PickupServicePointFilter/PickupServicePointFilter.test.js b/src/components/RequestsFilters/PickupServicePointFilter/PickupServicePointFilter.test.js index 9858f065b..6be7f1d00 100644 --- a/src/components/RequestsFilters/PickupServicePointFilter/PickupServicePointFilter.test.js +++ b/src/components/RequestsFilters/PickupServicePointFilter/PickupServicePointFilter.test.js @@ -4,8 +4,6 @@ import { } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '__mock__'; - import { Accordion, FilterAccordionHeader, diff --git a/src/components/RequestsFilters/RequestLevelFilter/RequestLevelFilter.js b/src/components/RequestsFilters/RequestLevelFilter/RequestLevelFilter.js index f1537e7d0..25c6f2b27 100644 --- a/src/components/RequestsFilters/RequestLevelFilter/RequestLevelFilter.js +++ b/src/components/RequestsFilters/RequestLevelFilter/RequestLevelFilter.js @@ -40,6 +40,7 @@ const RequestLevelFilter = ({ ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -
- {children} -
-)); - describe('RequestLevelFilter', () => { const testOnClearCallback = jest.fn(); const testOnChangeCallback = () => {}; @@ -46,7 +34,6 @@ describe('RequestLevelFilter', () => { }; afterEach(() => { - Accordion.mockClear(); FilterAccordionHeader.mockClear(); CheckboxFilter.mockClear(); testOnClearCallback.mockClear(); @@ -73,7 +60,7 @@ describe('RequestLevelFilter', () => { it('should handle clear filters', () => { expect(testOnClearCallback).not.toHaveBeenCalled(); - fireEvent.click(screen.getByTestId(testIds.accordion)); + fireEvent.click(screen.getByTestId(`${testIds.requestLevelFilter}Button`)); expect(testOnClearCallback).toHaveBeenCalledWith(requestFilterTypes.REQUEST_LEVELS); }); diff --git a/src/components/RequestsRouteShortcutsWrapper/RequestsRouteShortcutsWrapper.test.js b/src/components/RequestsRouteShortcutsWrapper/RequestsRouteShortcutsWrapper.test.js index 641fad02f..04993040e 100644 --- a/src/components/RequestsRouteShortcutsWrapper/RequestsRouteShortcutsWrapper.test.js +++ b/src/components/RequestsRouteShortcutsWrapper/RequestsRouteShortcutsWrapper.test.js @@ -1,8 +1,5 @@ -import React from 'react'; import { render } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { CommandList, defaultKeyboardShortcuts, diff --git a/src/components/SortableList/DraggableRow.test.js b/src/components/SortableList/DraggableRow.test.js index 4974152c5..109db14b4 100644 --- a/src/components/SortableList/DraggableRow.test.js +++ b/src/components/SortableList/DraggableRow.test.js @@ -1,4 +1,3 @@ -import React from 'react'; import { render, screen, diff --git a/src/components/SortableList/SortableList.test.js b/src/components/SortableList/SortableList.test.js index 7b4d116b9..251c82d33 100644 --- a/src/components/SortableList/SortableList.test.js +++ b/src/components/SortableList/SortableList.test.js @@ -3,8 +3,6 @@ import { screen, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import SortableList from './SortableList'; jest.mock('react-beautiful-dnd', () => ({ diff --git a/src/components/TitleInformation/TitleInformation.test.js b/src/components/TitleInformation/TitleInformation.test.js index 23702c165..bdd00faef 100644 --- a/src/components/TitleInformation/TitleInformation.test.js +++ b/src/components/TitleInformation/TitleInformation.test.js @@ -1,10 +1,7 @@ -import React from 'react'; import { render, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { KeyValue, } from '@folio/stripes/components'; diff --git a/src/components/ViewRequestShortcutsWrapper/ViewRequestShortcutsWrapper.test.js b/src/components/ViewRequestShortcutsWrapper/ViewRequestShortcutsWrapper.test.js index 3314cef83..6ae848b6e 100644 --- a/src/components/ViewRequestShortcutsWrapper/ViewRequestShortcutsWrapper.test.js +++ b/src/components/ViewRequestShortcutsWrapper/ViewRequestShortcutsWrapper.test.js @@ -1,8 +1,5 @@ -import React from 'react'; import { render } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { CommandList, defaultKeyboardShortcuts, diff --git a/src/routes/NoteCreateRoute.test.js b/src/routes/NoteCreateRoute.test.js index 2f4e183f9..c42e0d15d 100644 --- a/src/routes/NoteCreateRoute.test.js +++ b/src/routes/NoteCreateRoute.test.js @@ -1,5 +1,8 @@ -import '__mock__/'; -import { render, screen } from '@folio/jest-config-stripes/testing-library/react'; +import { + render, + screen, +} from '@folio/jest-config-stripes/testing-library/react'; + import { historyData } from '../../test/jest/fixtures/historyData'; import NoteCreateRoute from './NoteCreateRoute'; @@ -12,6 +15,7 @@ const locationData = historyData.location; const renderNoteCreateRoute = (locationProps, historyProps) => render( ); + describe('NoteCreateRoute', () => { it('NoteCreatePage should render when location.state is not empty', () => { renderNoteCreateRoute(locationData, historyData); diff --git a/src/routes/NoteEditRoute.test.js b/src/routes/NoteEditRoute.test.js index 630d6b734..c72e1b329 100644 --- a/src/routes/NoteEditRoute.test.js +++ b/src/routes/NoteEditRoute.test.js @@ -1,5 +1,3 @@ -import '__mock__/'; - import { render, screen, diff --git a/src/routes/NoteViewRoute.test.js b/src/routes/NoteViewRoute.test.js index a9bcb0e62..ea90f5497 100644 --- a/src/routes/NoteViewRoute.test.js +++ b/src/routes/NoteViewRoute.test.js @@ -4,8 +4,6 @@ import { } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '__mock__/'; - import NoteViewRoute from './NoteViewRoute'; import { historyData, diff --git a/src/routes/RequestQueueRoute.test.js b/src/routes/RequestQueueRoute.test.js index ffa01bcb3..cdc21d049 100644 --- a/src/routes/RequestQueueRoute.test.js +++ b/src/routes/RequestQueueRoute.test.js @@ -1,8 +1,6 @@ import { render } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '__mock__'; - import RequestQueueRoute from './RequestQueueRoute'; jest.mock('react-router-prop-types', () => ({ diff --git a/src/routes/RequestsRoute.test.js b/src/routes/RequestsRoute.test.js index 5871d5ad0..0ce028934 100644 --- a/src/routes/RequestsRoute.test.js +++ b/src/routes/RequestsRoute.test.js @@ -1,4 +1,7 @@ import React from 'react'; +import { + stringify, +} from 'query-string'; import { render, @@ -8,11 +11,6 @@ import { } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '../../test/jest/__mock__'; - -import { - stringify, -} from 'query-string'; import { SearchAndSort, } from '@folio/stripes/smart-components'; diff --git a/src/utils.test.js b/src/utils.test.js index 981469de9..60f01266c 100644 --- a/src/utils.test.js +++ b/src/utils.test.js @@ -2,7 +2,6 @@ import { escape, noop, } from 'lodash'; -import '../test/jest/__mock__'; import { buildTemplate, diff --git a/src/views/RequestQueueView.test.js b/src/views/RequestQueueView.test.js index 7cc81f810..d2622c021 100644 --- a/src/views/RequestQueueView.test.js +++ b/src/views/RequestQueueView.test.js @@ -4,8 +4,6 @@ import { } from '@folio/jest-config-stripes/testing-library/react'; import userEvent from '@folio/jest-config-stripes/testing-library/user-event'; -import '__mock__'; - import { AccordionSet, } from '@folio/stripes/components'; diff --git a/src/views/components/FulfillmentRequestsData.test.js b/src/views/components/FulfillmentRequestsData.test.js index 0e4c3e049..3887b0022 100644 --- a/src/views/components/FulfillmentRequestsData.test.js +++ b/src/views/components/FulfillmentRequestsData.test.js @@ -1,10 +1,7 @@ -import React from 'react'; import { render, } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { MultiColumnList, } from '@folio/stripes/components'; diff --git a/src/views/components/ItemLink.test.js b/src/views/components/ItemLink.test.js index ffc4bf876..cf03b0c45 100644 --- a/src/views/components/ItemLink.test.js +++ b/src/views/components/ItemLink.test.js @@ -1,11 +1,9 @@ -import React from 'react'; +import { BrowserRouter } from 'react-router-dom'; + import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import { BrowserRouter } from 'react-router-dom'; - -import '../../../test/jest/__mock__'; import ItemLink from './ItemLink'; diff --git a/src/views/components/NotYetFilledRequestsData.test.js b/src/views/components/NotYetFilledRequestsData.test.js index f05c1da13..2e818b1be 100644 --- a/src/views/components/NotYetFilledRequestsData.test.js +++ b/src/views/components/NotYetFilledRequestsData.test.js @@ -1,8 +1,5 @@ -import React from 'react'; import { render } from '@folio/jest-config-stripes/testing-library/react'; -import '../../../test/jest/__mock__'; - import { SortableList } from '../../components'; import NotYetFilledRequestsData, { COLUMN_NAMES, diff --git a/src/views/components/RequesterLink.test.js b/src/views/components/RequesterLink.test.js index 2f6f66ab9..3c408314d 100644 --- a/src/views/components/RequesterLink.test.js +++ b/src/views/components/RequesterLink.test.js @@ -1,11 +1,9 @@ -import React from 'react'; +import { BrowserRouter } from 'react-router-dom'; + import { render, screen, } from '@folio/jest-config-stripes/testing-library/react'; -import { BrowserRouter } from 'react-router-dom'; - -import '../../../test/jest/__mock__'; import RequesterLink from './RequesterLink'; diff --git a/src/views/constants.test.js b/src/views/constants.test.js index 2f6c3a158..46eb4fbe5 100644 --- a/src/views/constants.test.js +++ b/src/views/constants.test.js @@ -3,8 +3,6 @@ import { render, } from '@folio/jest-config-stripes/testing-library/react'; -import '__mock__'; - import { formatter, } from './constants'; diff --git a/test/jest/__mock__/stripesComponents.mock.js b/test/jest/__mock__/stripesComponents.mock.js index cb3b67e01..7e2ec9d13 100644 --- a/test/jest/__mock__/stripesComponents.mock.js +++ b/test/jest/__mock__/stripesComponents.mock.js @@ -116,11 +116,23 @@ jest.mock('@folio/stripes/components', () => ({ NoValue: jest.fn(() => ( No value )), - Pane: jest.fn(({ children }) => ( -
- {children} -
- )), + Pane: jest.fn(({ children, className, defaultWidth, paneTitle, firstMenu, lastMenu, actionMenu, ...rest }) => { + return ( +
+
+ {firstMenu ?? null} + {paneTitle} + {actionMenu ? actionMenu({ onToggle: jest.fn() }) : null} + {lastMenu ?? null} +
+ {children} +
+ ); + }), PaneFooter: jest.fn(({ children }) => (
{children}