Skip to content

Commit

Permalink
tests: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Dec 7, 2023
1 parent 6405f25 commit c5c348e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/contacts/ViewContact/ViewContactContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import { DICT_CATEGORIES } from '../../common/constants';
import { getBackPath } from '../../common/utils/createItem';
import { useTranslatedCategories } from '../../common/hooks';

import { PRIVILEGED_CONTACT_URL_PATH } from '../constants';
import ViewContact from './ViewContact';
import {
deleteContact,
unassign,
} from './util';
import { PRIVILEGED_CONTACT_URL_PATH } from '../constants';

export function ViewContactContainer({
baseUrl,
Expand Down
23 changes: 23 additions & 0 deletions src/contacts/ViewContact/ViewContactContainer.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 { match, history } from '../../../test/jest/routerMocks';
import { DICT_CATEGORIES } from '../../common/constants';
import { PRIVILEGED_CONTACT_URL_PATH } from '../constants';
import ViewContact from './ViewContact';
import { ViewContactContainer } from './ViewContactContainer';

Expand All @@ -22,6 +23,12 @@ const defaultProps = {
resources: {
contact: { isPending: false },
[DICT_CATEGORIES]: { records: [] },
privilegedContact: {
records: [{
id: 'contactId',
categories: [],
}],
},
},
match,
history: historyMock,
Expand All @@ -40,6 +47,22 @@ describe('ViewContactContainer', () => {
expect(screen.getByText('Icon')).toBeDefined();
});

it('should display ViewContact with privileged contacts', async () => {
const contactProps = {
...defaultProps,
match: {
...defaultProps.match,
path: `/${PRIVILEGED_CONTACT_URL_PATH}`,
},
};

renderViewContactContainer(contactProps);

await screen.findByText('ViewContact');

expect(screen.getByText('ViewContact')).toBeDefined();
});

it('should display ViewContact', async () => {
renderViewContactContainer();

Expand Down

0 comments on commit c5c348e

Please sign in to comment.