Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariia-aloshyna committed Oct 13, 2023
1 parent 69396b4 commit 4244578
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Instance/ItemsList/ItemBarcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const ItemBarcode = ({
buttonStyle="link"
buttonClass={css.linkWithoutBorder}
onClick={() => switchAffiliation(stripes.okapi, tenantId, onViewItem)}
data-test-item-link
>
{itemBarcode}
</Button>
Expand Down
9 changes: 5 additions & 4 deletions src/Instance/ItemsList/tests/ItemBarcode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,20 @@ describe('<ItemBarcode>', () => {

it('should render barcode as a hotlink', () => {
const history = getHistory(searchItem(QUERY_INDEXES.BARCODE));
const { container } = setupItemBarcode({ ...itemBarcodeProps, history });
const { getByRole } = setupItemBarcode({ ...itemBarcodeProps, history });

expect(container.querySelector('[data-test-item-link="true"]')).toBeInTheDocument();
expect(getByRole('button', { name: itemProp.barcode })).toBeInTheDocument();
});

it('should render barcode as a plain text', () => {
const history = getHistory(searchItem(QUERY_INDEXES.BARCODE));
const { container } = setupItemBarcode({
const { queryByRole, getByText } = setupItemBarcode({
...itemBarcodeProps,
isBarcodeAsHotlink: false,
history,
});

expect(container.querySelector('[data-test-item-link="true"]')).not.toBeInTheDocument();
expect(queryByRole('button', { name: itemProp.barcode })).not.toBeInTheDocument();
expect(getByText(itemProp.barcode)).toBeInTheDocument();
});
});

0 comments on commit 4244578

Please sign in to comment.