diff --git a/lib/AcqUnitFilter/AcqUnitFilter.test.js b/lib/AcqUnitFilter/AcqUnitFilter.test.js
index 1284ebb0..29019936 100644
--- a/lib/AcqUnitFilter/AcqUnitFilter.test.js
+++ b/lib/AcqUnitFilter/AcqUnitFilter.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render, cleanup } from '@testing-library/react';
+import { fireEvent, render, cleanup } from '@testing-library/react';
import { noop } from 'lodash';
import AcqUnitFilter from './AcqUnitFilter';
@@ -23,7 +23,9 @@ describe('AcqUnitFilter component', () => {
afterEach(cleanup);
it('should render all passed options', async () => {
- const { findAllByText } = renderAcqUnitFilter(acqUnitsRecords);
+ const { findAllByText, getByText } = renderAcqUnitFilter(acqUnitsRecords);
+
+ await fireEvent.click(getByText('stripes-components.selection.controlLabel'));
const renderedFilterOptions = await findAllByText(/Unit #[0-9]/);
diff --git a/lib/AffiliationsSelection/AffiliationsSelection.test.js b/lib/AffiliationsSelection/AffiliationsSelection.test.js
index e83da191..0d209615 100644
--- a/lib/AffiliationsSelection/AffiliationsSelection.test.js
+++ b/lib/AffiliationsSelection/AffiliationsSelection.test.js
@@ -9,6 +9,17 @@ import { AffiliationsSelection } from './AffiliationsSelection';
jest.unmock('@folio/stripes/components');
jest.unmock('@folio/stripes/smart-components');
+jest.mock('@folio/stripes/components', () => ({
+ ...jest.requireActual('@folio/stripes/components'),
+ Selection: ({ id, dataOptions }) => (
+
+ {
+ dataOptions.map((o) => - {o.label}
)
+ }
+
+ ),
+}));
+
const defaultProps = {
id: 'test',
affiliations,
@@ -34,7 +45,7 @@ describe('AffiliationsSelection', () => {
).toBeInTheDocument();
affiliations.forEach(({ tenantName, isPrimary }) => {
expect(
- within(document.getElementById('sl-container-test-affiliations-select'))
+ within(document.getElementById('test-affiliations-select'))
.getByText(isPrimary ? `${tenantName} stripes-acq-components.consortia.affiliations.primary.label` : tenantName),
).toBeInTheDocument();
});
diff --git a/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.test.js b/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.test.js
index 33fbc315..badeb4ac 100644
--- a/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.test.js
+++ b/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.test.js
@@ -59,6 +59,7 @@ describe('ConsortiumFieldInventory', () => {
renderConsortiumFieldInventory({ onAffiliationChange });
+ await userEvent.click(screen.getAllByText('stripes-components.selection.controlLabel')[0]);
await userEvent.click(screen.getByText(tenants[1].name));
expect(onAffiliationChange).toHaveBeenCalled();
diff --git a/lib/CountryFilter/CountryFilter.test.js b/lib/CountryFilter/CountryFilter.test.js
index bfc065df..bdac6a53 100644
--- a/lib/CountryFilter/CountryFilter.test.js
+++ b/lib/CountryFilter/CountryFilter.test.js
@@ -28,13 +28,15 @@ describe('CountryFilter component', () => {
it('should invoke onChange callback when something is selected', async () => {
const onChangeFilter = jest.fn();
const { container, getByText } = renderFilter(false, onChangeFilter);
- const afgOption = getByText('AF');
const button = container.querySelector('[id="org-filter-country-selection"]');
+ fireEvent.click(button);
+
+ const afgOption = getByText('AF');
+
expect(button).toBeEnabled();
expect(onChangeFilter).not.toHaveBeenCalled();
- fireEvent.click(button);
fireEvent.click(afgOption);
expect(onChangeFilter).toHaveBeenCalled();
diff --git a/lib/Currency/FieldCurrency/FieldCurrency.test.js b/lib/Currency/FieldCurrency/FieldCurrency.test.js
index 62ddde09..733b11ab 100644
--- a/lib/Currency/FieldCurrency/FieldCurrency.test.js
+++ b/lib/Currency/FieldCurrency/FieldCurrency.test.js
@@ -31,11 +31,13 @@ const renderComponent = (props = {}) => (render(
describe('FieldCurrency', () => {
it('should display CurrencyValue if non-interactive', () => {
renderComponent({ isNonInteractive: true, value: 'EUR' });
+
expect(screen.getByText('EUR')).toBeDefined();
});
it('should display FieldCurrency', () => {
renderComponent();
+
expect(screen.getByText('stripes-acq-components.currency')).toBeDefined();
});
@@ -43,7 +45,10 @@ describe('FieldCurrency', () => {
const onChange = jest.fn();
renderComponent({ onChange });
+
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText('USD (USD)'));
+
expect(onChange).toHaveBeenCalled();
});
});
diff --git a/lib/CurrencyExchangeRateFields/CurrencyExchangeRateFields.test.js b/lib/CurrencyExchangeRateFields/CurrencyExchangeRateFields.test.js
index 097a74a2..356752d7 100644
--- a/lib/CurrencyExchangeRateFields/CurrencyExchangeRateFields.test.js
+++ b/lib/CurrencyExchangeRateFields/CurrencyExchangeRateFields.test.js
@@ -39,6 +39,7 @@ describe('CurrencyExchangeRateFields', () => {
renderComponent({ onSubmit });
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText('BYN (BYN)'));
user.click(screen.getByTestId('use-set-exhange-rate'));
user.type(screen.getByTestId('exchange-rate'), '2.66');
diff --git a/lib/DeleteHoldingsModal/DeleteHoldingsModal.test.js b/lib/DeleteHoldingsModal/DeleteHoldingsModal.test.js
index 18abb429..7cd09440 100644
--- a/lib/DeleteHoldingsModal/DeleteHoldingsModal.test.js
+++ b/lib/DeleteHoldingsModal/DeleteHoldingsModal.test.js
@@ -48,6 +48,7 @@ describe('DeleteHoldingsModal', () => {
const deleteBtn = await screen.findByRole('button', {
name: 'stripes-acq-components.holdings.deleteModal.heading',
+ hidden: true,
});
user.click(deleteBtn);
diff --git a/lib/DynamicSelection/DynamicSelection.test.js b/lib/DynamicSelection/DynamicSelection.test.js
index 6e9b21d4..edf7be95 100644
--- a/lib/DynamicSelection/DynamicSelection.test.js
+++ b/lib/DynamicSelection/DynamicSelection.test.js
@@ -47,7 +47,7 @@ describe('DynamicSelection', () => {
const input = screen.getByLabelText('stripes-components.selection.filterOptionsLabel', { selector: 'input' });
await act(async () => {
- user.type(input, '1');
+ await user.type(input, '1');
jest.advanceTimersByTime(1500);
});
@@ -60,10 +60,11 @@ describe('DynamicSelection', () => {
const input = screen.getByLabelText('stripes-components.selection.filterOptionsLabel', { selector: 'input' });
await act(async () => {
- user.type(input, '1');
+ await user.type(input, '1');
jest.advanceTimersByTime(1500);
});
-
+
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText(/11111/));
expect(defaultProps.onChange).toHaveBeenCalled();
diff --git a/lib/DynamicSelectionFilter/DynamicSelectionFilter.test.js b/lib/DynamicSelectionFilter/DynamicSelectionFilter.test.js
index aa196566..9c5cb6ea 100644
--- a/lib/DynamicSelectionFilter/DynamicSelectionFilter.test.js
+++ b/lib/DynamicSelectionFilter/DynamicSelectionFilter.test.js
@@ -56,13 +56,7 @@ describe('DynamicSelectionFilter', () => {
renderDynamicSelectionFilter();
});
- const input = screen.getByLabelText('stripes-components.selection.filterOptionsLabel', { selector: 'input' });
-
- await act(async () => {
- user.type(input, '1');
- jest.advanceTimersByTime(1500);
- });
-
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText(/11111/));
expect(defaultProps.onChange).toHaveBeenCalled();
diff --git a/lib/FieldHolding/FieldHolding.test.js b/lib/FieldHolding/FieldHolding.test.js
index 7455fca7..bd4517b4 100644
--- a/lib/FieldHolding/FieldHolding.test.js
+++ b/lib/FieldHolding/FieldHolding.test.js
@@ -1,4 +1,4 @@
-import { render, screen, within } from '@testing-library/react';
+import { render, screen, within, fireEvent } from '@testing-library/react';
import keyBy from 'lodash/keyBy';
import { Form } from 'react-final-form';
@@ -58,7 +58,9 @@ describe('FieldHolding component', () => {
});
it('should render holding options', async () => {
- const { findAllByText } = renderFieldHolding({});
+ const { findAllByText, getByText } = renderFieldHolding({});
+
+ fireEvent.click(getByText('stripes-components.selection.controlLabel'));
const renderedHoldingOptions = await findAllByText(/Location #[0-9]/);
diff --git a/lib/FieldLocation/FieldLocationFinal.test.js b/lib/FieldLocation/FieldLocationFinal.test.js
index ca8b7b3b..b956c711 100644
--- a/lib/FieldLocation/FieldLocationFinal.test.js
+++ b/lib/FieldLocation/FieldLocationFinal.test.js
@@ -1,4 +1,4 @@
-import { render, cleanup, screen } from '@testing-library/react';
+import { render, cleanup, screen, fireEvent } from '@testing-library/react';
import { Form } from 'react-final-form';
import FieldLocationFinal from './FieldLocationFinal';
@@ -44,6 +44,8 @@ describe('FieldLocationFinal component', () => {
it('should render all passed options', async () => {
renderFieldLocationFinal();
+ fireEvent.click(screen.getByText('stripes-components.selection.controlLabel'));
+
const renderedLocationOptions = await screen.findAllByText(/Location #[0-9]/);
expect(renderedLocationOptions.length).toBe(locationOptions.length);
diff --git a/lib/FieldLocation/FieldLocationFinalContainer.test.js b/lib/FieldLocation/FieldLocationFinalContainer.test.js
index e24e89ec..0dbd2244 100644
--- a/lib/FieldLocation/FieldLocationFinalContainer.test.js
+++ b/lib/FieldLocation/FieldLocationFinalContainer.test.js
@@ -1,4 +1,4 @@
-import { render, screen } from '@testing-library/react';
+import { render, screen, fireEvent } from '@testing-library/react';
import { Form } from 'react-final-form';
import FieldLocationFinalContainer from './FieldLocationFinalContainer';
@@ -41,6 +41,8 @@ describe('FieldLocationFinalContainer component', () => {
it('should render options based on passed locationIds', async () => {
renderFieldLocationFinalContainer();
+ fireEvent.click(screen.getByText('stripes-components.selection.controlLabel'));
+
const renderedLocationOptions = await screen.findAllByText(/Location #[0-9]/);
expect(renderedLocationOptions.length).toBe(locationsIds.length);
@@ -51,6 +53,8 @@ describe('FieldLocationFinalContainer component', () => {
filterLocations: (records) => records.slice(0, 2),
});
+ fireEvent.click(screen.getByText('stripes-components.selection.controlLabel'));
+
const renderedLocationOptions = await screen.findAllByText(/Location #[0-9]/);
expect(renderedLocationOptions).toHaveLength(2);
diff --git a/lib/FindLocation/FindLocationLookup.test.js b/lib/FindLocation/FindLocationLookup.test.js
index 979a0614..bfb24009 100644
--- a/lib/FindLocation/FindLocationLookup.test.js
+++ b/lib/FindLocation/FindLocationLookup.test.js
@@ -178,6 +178,8 @@ describe('FindLocationLookup', () => {
const affiliationSelection = await screen.findByText('affiliationsLabel');
expect(affiliationSelection).toBeInTheDocument();
+
+ await user.click(screen.getByText('stripes-components.selection.controlLabel'));
await user.click(screen.getByText(mockTenants[1].name));
expect(onTenantChange).toHaveBeenCalledWith(mockTenants[1].id);
diff --git a/lib/FundDistribution/FundDistributionFields/FundDistributionFieldsFinal.test.js b/lib/FundDistribution/FundDistributionFields/FundDistributionFieldsFinal.test.js
index 12f93657..b1e3c021 100644
--- a/lib/FundDistribution/FundDistributionFields/FundDistributionFieldsFinal.test.js
+++ b/lib/FundDistribution/FundDistributionFields/FundDistributionFieldsFinal.test.js
@@ -82,6 +82,7 @@ describe('FundDistributionFieldsFinal', () => {
renderComponent({ onSelectFund });
user.click(screen.getByText('stripes-acq-components.fundDistribution.addBtn'));
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText('african (AFRICAHIST)'));
expect(onSelectFund).toHaveBeenCalledWith('fund-distribution[0]', '1');
@@ -243,6 +244,7 @@ describe('FundDistributionFieldsFinal', () => {
const { container } = renderComponent({});
user.click(screen.getByText('stripes-acq-components.fundDistribution.addBtn'));
+ user.click(screen.getByText('stripes-components.selection.controlLabel'));
user.click(screen.getByText('african (AFRICAHIST)'));
const removeBtn = container.querySelector('.repeatableFieldRemoveItem button');
diff --git a/lib/FundFilter/FundFilter.test.js b/lib/FundFilter/FundFilter.test.js
index 2ce359f5..800b9f15 100644
--- a/lib/FundFilter/FundFilter.test.js
+++ b/lib/FundFilter/FundFilter.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from '@testing-library/react';
+import { render, fireEvent } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { noop } from 'lodash';
@@ -47,7 +47,9 @@ describe('FundFilter component', () => {
});
it('should render all passed options', async () => {
- const { findAllByText } = renderFundFilter(fundRecords);
+ const { findAllByText, getByText } = renderFundFilter(fundRecords);
+
+ fireEvent.click(getByText('stripes-components.selection.controlLabel'));
const renderedFilterOptions = await findAllByText(/Fund #[0-9]/);
diff --git a/lib/LanguageFilter/LanguageFilter.test.js b/lib/LanguageFilter/LanguageFilter.test.js
index 21ba4777..d1993f7e 100644
--- a/lib/LanguageFilter/LanguageFilter.test.js
+++ b/lib/LanguageFilter/LanguageFilter.test.js
@@ -28,13 +28,15 @@ describe('LanguageFilter component', () => {
it('should invoke onChange callback when something is selected', async () => {
const onChangeFilter = jest.fn();
const { container, getByText } = renderFilter(false, onChangeFilter);
- const option = getByText('Abkhazian');
const button = container.querySelector('[id="org-filter-language-selection"]');
+ fireEvent.click(button);
+
+ const option = getByText('Abkhazian');
+
expect(button).toBeEnabled();
expect(onChangeFilter).not.toHaveBeenCalled();
- fireEvent.click(button);
fireEvent.click(option);
expect(onChangeFilter).toHaveBeenCalled();
diff --git a/lib/MaterialTypeFilter/MaterialTypeFilterContainer.test.js b/lib/MaterialTypeFilter/MaterialTypeFilterContainer.test.js
index e32d387b..fde4d0e4 100644
--- a/lib/MaterialTypeFilter/MaterialTypeFilterContainer.test.js
+++ b/lib/MaterialTypeFilter/MaterialTypeFilterContainer.test.js
@@ -44,6 +44,7 @@ describe('MaterialTypeFilterContainer', () => {
it('should call onChange', async () => {
renderComponent({ activeFilter: '1' });
+ await user.click(screen.getByText('stripes-components.selection.controlLabel'));
await user.click(screen.getByText('type 1'));
expect(defaultProps.onChange).toHaveBeenCalled();
diff --git a/lib/hooks/consortia/useConsortiumTenants/useConsortiumTenants.js b/lib/hooks/consortia/useConsortiumTenants/useConsortiumTenants.js
index 1413d878..380ac6e0 100644
--- a/lib/hooks/consortia/useConsortiumTenants/useConsortiumTenants.js
+++ b/lib/hooks/consortia/useConsortiumTenants/useConsortiumTenants.js
@@ -37,7 +37,7 @@ export const useConsortiumTenants = (options = {}) => {
} = useQuery({
queryKey: [namespace, consortium?.id],
queryFn: ({ signal }) => ky.get(
- `${CONSORTIA_API}/${consortium.id}/${CONSORTIA_CONSORTIUM_TENANTS_API}`,
+ `${CONSORTIA_API}/${consortium.id}/${CONSORTIA_CONSORTIUM_TENANTS_API}?limit=1000`,
{ signal },
).json(),
enabled,