Skip to content

Commit

Permalink
UIREQ-996: Update Jest/RTL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy-Litvinenko committed Sep 27, 2023
1 parent 309f650 commit cfb0e4e
Show file tree
Hide file tree
Showing 46 changed files with 45 additions and 126 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
* Hit Enter or Search should move focus to the Results List pane header. Refs UIREQ-564.
* Add "operation" parameter to "allowed-service-points" endpoint. Refs UIREQ-1028.
* Fix issues with skipped tests. Refs UIREQ-1024.
* Update Jest/RTL tests. Refs UIREQ-996.

## [8.0.2](https://github.com/folio-org/ui-requests/tree/v8.0.2) (2023-03-29)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v8.0.1...v8.0.2)
Expand Down
2 changes: 0 additions & 2 deletions src/CancelRequestDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
screen,
} from '@folio/jest-config-stripes/testing-library/react';

import '../test/jest/__mock__';

import CancelRequestDialog from './CancelRequestDialog';

const labelIds = {
Expand Down
3 changes: 0 additions & 3 deletions src/ChooseRequestTypeDialog.test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 1 addition & 3 deletions src/ItemDetail.test.js
Original file line number Diff line number Diff line change
@@ -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', () => ({
Expand Down
20 changes: 10 additions & 10 deletions src/ItemsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ const ItemsDialog = ({
{isLoading || areItemsBeingLoaded
? <Loading data-testid="loading" />
: <MultiColumnList
id="instance-items-list"
interactive
contentData={contentData}
visibleColumns={COLUMN_NAMES}
columnMapping={COLUMN_MAP}
columnWidths={COLUMN_WIDTHS}
formatter={formatter}
maxHeight={MAX_HEIGHT}
isEmptyMessage={formatMessage({ id: 'ui-requests.items.instanceItems.notFound' })}
onRowClick={onRowClick}
id="instance-items-list"
interactive
contentData={contentData}
visibleColumns={COLUMN_NAMES}
columnMapping={COLUMN_MAP}
columnWidths={COLUMN_WIDTHS}
formatter={formatter}
maxHeight={MAX_HEIGHT}
isEmptyMessage={formatMessage({ id: 'ui-requests.items.instanceItems.notFound' })}
onRowClick={onRowClick}
/>
}
</Pane>
Expand Down
3 changes: 0 additions & 3 deletions src/ItemsDialog.test.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/MoveRequestManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 0 additions & 2 deletions src/PatronBlockModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 0 additions & 3 deletions src/PositionLink.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
render,
screen,
Expand All @@ -8,8 +7,6 @@ import {
requestStatuses,
} from './constants';

import '../test/jest/__mock__';

import PositionLink from './PositionLink';

jest.mock('react-router-dom', () => ({
Expand Down
7 changes: 2 additions & 5 deletions src/RequestForm.test.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/RequestFormContainer.test.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 0 additions & 2 deletions src/UserDetail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions src/UserForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 2 additions & 4 deletions src/ViewRequest.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
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,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ComponentToPrint/ComponentToPrint.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Parser } from 'html-to-react';

import {
render,
screen,
Expand Down
3 changes: 0 additions & 3 deletions src/components/ErrorModal/ErrorModal.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
render,
screen,
Expand All @@ -7,8 +6,6 @@ import {

import { runAxeTest } from '@folio/stripes-testing';

import '../../../test/jest/__mock__';

import ErrorModal from './ErrorModal';

describe('ErrorModal', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { FormattedMessage } from 'react-intl';

import {
render,
screen,
fireEvent,
cleanup,
} from '@folio/jest-config-stripes/testing-library/react';

import '../../../test/jest/__mock__';

import { FormattedMessage } from 'react-intl';

import FulfilmentPreference, {
validate,
} from './FulfilmentPreference';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useState } from 'react';
import { Field } from 'react-final-form';

import {
render,
screen,
Expand All @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions src/components/ItemInformation/ItemInformation.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useState } from 'react';
import { Field } from 'react-final-form';

import {
render,
screen,
fireEvent,
cleanup,
waitFor,
} from '@folio/jest-config-stripes/testing-library/react';

import '../../../test/jest/__mock__';

import { Field } from 'react-final-form';
import {
Icon,
TextField,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Loading/Loading.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 0 additions & 2 deletions src/components/LoadingButton/LoadingButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
screen,
} from '@folio/jest-config-stripes/testing-library/react';

import '__mock__';

import {
Button,
Icon,
Expand Down
6 changes: 2 additions & 4 deletions src/components/PrintButton/PrintButton.test.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
2 changes: 0 additions & 2 deletions src/components/PrintContent/PrintContent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ReferredRecord/ReferredRecord.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import '../../../test/jest/__mock__';

import {
render,
screen,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
6 changes: 2 additions & 4 deletions src/components/RequestInformation/RequestInformation.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useState } from 'react';
import { Field } from 'react-final-form';

import {
render,
screen,
fireEvent,
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, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useState } from 'react';
import { Field } from 'react-final-form';

import {
render,
screen,
Expand All @@ -7,7 +9,6 @@ import {
waitFor,
} from '@folio/jest-config-stripes/testing-library/react';

import { Field } from 'react-final-form';
import {
Icon,
TextField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import React from 'react';
import {
render,
screen,
fireEvent,
} from '@folio/jest-config-stripes/testing-library/react';

import '../../../../test/jest/__mock__';

import {
Accordion,
FilterAccordionHeader,
} from '@folio/stripes/components';
import { CheckboxFilter } from '@folio/stripes/smart-components';

import RequestLevelFilter from './RequestLevelFilter';
import {
requestFilterTypes,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/components/SortableList/DraggableRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
render,
screen,
Expand Down
2 changes: 0 additions & 2 deletions src/components/SortableList/SortableList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => ({
Expand Down
Loading

0 comments on commit cfb0e4e

Please sign in to comment.