From 4244578e1fb925c6123f30a1a4029a5fc4a1aad8 Mon Sep 17 00:00:00 2001 From: Mariia_Aloshyna Date: Fri, 13 Oct 2023 18:58:47 +0300 Subject: [PATCH] Adjust tests --- src/Instance/ItemsList/ItemBarcode.js | 1 - src/Instance/ItemsList/tests/ItemBarcode.test.js | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Instance/ItemsList/ItemBarcode.js b/src/Instance/ItemsList/ItemBarcode.js index ffca47228..c8f64a3f5 100644 --- a/src/Instance/ItemsList/ItemBarcode.js +++ b/src/Instance/ItemsList/ItemBarcode.js @@ -68,7 +68,6 @@ const ItemBarcode = ({ buttonStyle="link" buttonClass={css.linkWithoutBorder} onClick={() => switchAffiliation(stripes.okapi, tenantId, onViewItem)} - data-test-item-link > {itemBarcode} diff --git a/src/Instance/ItemsList/tests/ItemBarcode.test.js b/src/Instance/ItemsList/tests/ItemBarcode.test.js index 170b843d7..043b57cef 100644 --- a/src/Instance/ItemsList/tests/ItemBarcode.test.js +++ b/src/Instance/ItemsList/tests/ItemBarcode.test.js @@ -93,19 +93,20 @@ describe('', () => { 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(); }); });