Skip to content

Commit

Permalink
refine and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed Dec 10, 2024
1 parent a42a183 commit 1983bfa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/components/RequestsFilters/RequestsFilters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ jest.mock('./RequestLevelFilter', () => ({
jest.mock('./PickupServicePointFilter', () => ({
PickupServicePointFilter: jest.fn((props) => (<div {...props} />)),
}));
jest.mock('./RetrievalServicePointFilter', () => ({
RetrievalServicePointFilter: jest.fn((props) => (<div {...props} />)),
}));
jest.mock('../../hooks', () => ({
...jest.requireActual('../../hooks'),
useRetrievalServicePoints: jest.fn(),
useRetrievalServicePoints: jest.fn().mockReturnValue([
{
value: '3a40852d-49fd-4df2-a1f9-6e2641a6e91f',
label: 'Circ desk 1',
},
{
value: '9d1b77e8-f02e-4b7f-b296-3f2042ddac54',
label: 'Circ desk 2',
},
]),
}));
jest.mock('@folio/stripes/smart-components', () => ({
CheckboxFilter: jest.fn((props) => (<div {...props} />)),
Expand All @@ -43,6 +55,7 @@ const props = {
requestStatus: ['Open'],
requestType: ['Hold'],
pickupServicePoints: ['1'],
retrievalServicePoints: ['1', '2'],
tags: ['Urgent'],
requestLevels: [],
printStatus: ['Printed'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
requestFilterTypes,
} from '../../../constants';

import useRetrievalServicePoints from '../../../hooks/useRetrievalServicePoints/useRetrievalServicePoints';
import { useRetrievalServicePoints } from '../../../hooks';

const RetrievalServicePointFilter = ({
activeValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ import { requestFilterTypes } from '../../../constants';

jest.mock('../../../hooks', () => ({
...jest.requireActual('../../../hooks'),
useRetrievalServicePoints: jest.fn(),
useRetrievalServicePoints: jest.fn().mockReturnValue([
{
value: '3a40852d-49fd-4df2-a1f9-6e2641a6e91f',
label: 'Circ desk 1',
},
{
value: '9d1b77e8-f02e-4b7f-b296-3f2042ddac54',
label: 'Circ desk 2',
},
]),
}));

const activeValues = ['test', 'test2'];
Expand Down
1 change: 1 addition & 0 deletions src/hooks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useRetrievalServicePoints } from './useRetrievalServicePoints';
1 change: 1 addition & 0 deletions src/hooks/useRetrievalServicePoints/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as useRetrievalServicePoints } from './useRetrievalServicePoints';

0 comments on commit 1983bfa

Please sign in to comment.