Skip to content

Commit

Permalink
add test for the select agreement button
Browse files Browse the repository at this point in the history
  • Loading branch information
MonireRasouli committed Jan 16, 2025
1 parent 731ff8f commit 3d12de7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1,327 deletions.
12 changes: 2 additions & 10 deletions src/components/views/Basket/Basket.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ import { useOkapiKy } from '@folio/stripes/core';

import {
Button,
Col,
IconButton,
Layout,
MessageBanner,
Pane,
PaneMenu,
Paneset,
Row,
} from '@folio/stripes/components';

import { AGREEMENT_ENDPOINT } from '../../../constants';
Expand Down Expand Up @@ -202,14 +200,8 @@ const Basket = ({
selectedItems={selectedItems}
/>
<Layout className="marginTop1">
<Row>
<Col xs={3}>
{renderAddToAgreementButton()}
</Col>
<Col xs={3}>
{renderCreateAgreementButton()}
</Col>
</Row>
{renderCreateAgreementButton()}
{renderAddToAgreementButton()}
</Layout>
</div>
</Pane>
Expand Down
7 changes: 6 additions & 1 deletion src/components/views/Basket/Basket.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { MemoryRouter } from 'react-router-dom';

import { useMutation } from 'react-query';

import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
Expand All @@ -17,6 +16,7 @@ import translationsProperties from '../../../../test/helpers';
import { data, handlers } from './testResources';

jest.mock('../../BasketList', () => () => <div>BasketList</div>);
jest.mock('../../AgreementSearchButton', () => () => <div>AgreementSearchButton</div>);

/* EXAMPLE Mocking useMutation to allow us to test the .then clause */
// Setting up jest fn here to test paramters passed in by component
Expand Down Expand Up @@ -85,4 +85,9 @@ describe('Basket', () => {
await Button('Create new agreement').click();
});
});

it('renders the AgreementSearchButton component', () => {
const { getByText } = renderComponent;
expect(getByText('AgreementSearchButton')).toBeInTheDocument();
});
});
Loading

0 comments on commit 3d12de7

Please sign in to comment.