Skip to content

Commit

Permalink
UIIN-2699 added tests for not clickable browse result items
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis committed Nov 24, 2023
1 parent dac3169 commit d22f99f
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,16 @@ describe('getBrowseResultsFormatter', () => {
contributorTypeId: ['contributorTypeId'],
contributorNameTypeId: 'contributorNameTypeId',
totalRecords: 1,
},
{
name: 'Antoniou, Grigoris 2',
contributorTypeId: ['contributorTypeId'],
contributorNameTypeId: 'contributorNameTypeId',
totalRecords: 0,
isAnchor: false,
}
];
const [anchorRecord, nonAnchorRecord] = contentData;
const [anchorRecord, nonAnchorRecord, notClickableRecord] = contentData;

const renderContributorsList = (params = {}) => renderComponent({
contentData,
Expand All @@ -171,6 +178,9 @@ describe('getBrowseResultsFormatter', () => {
// Default row
expect(screen.getByText(nonAnchorRecord.name).tagName.toLowerCase()).not.toBe('strong');
expect(screen.getByText(nonAnchorRecord.totalRecords).tagName.toLowerCase()).not.toBe('strong');
// Non clickable row
expect(screen.getByText(notClickableRecord.name).tagName.toLowerCase()).not.toBe('strong');
expect(screen.getByText(notClickableRecord.totalRecords).tagName.toLowerCase()).not.toBe('strong');
});

it('should render \'Missed match item\' rows', () => {
Expand All @@ -190,6 +200,16 @@ describe('getBrowseResultsFormatter', () => {
expect(history.location.pathname).toEqual(INVENTORY_ROUTE);
});

it('should not navigate to instance "Search" page when not clickable target column was clicked', async () => {
renderContributorsList();

expect(history.location.pathname).toEqual(BROWSE_INVENTORY_ROUTE);

await act(async () => fireEvent.click(screen.getByText(notClickableRecord.name)));

expect(history.location.pathname).toEqual(BROWSE_INVENTORY_ROUTE);
});

it('should open the record in MARC authority app in new tab when "authority" icon was clicked', async () => {
renderContributorsList();

Expand Down

0 comments on commit d22f99f

Please sign in to comment.