diff --git a/src/components/HarvestingConfiguration/SelectedReports/SelectedReportsForm.js b/src/components/HarvestingConfiguration/SelectedReports/SelectedReportsForm.js index da48c71b..95a5db25 100644 --- a/src/components/HarvestingConfiguration/SelectedReports/SelectedReportsForm.js +++ b/src/components/HarvestingConfiguration/SelectedReports/SelectedReportsForm.js @@ -9,7 +9,7 @@ import counterReports from './data/counterReports'; import css from './SelectedReportsForm.css'; import SelectReportType from './SelectReportType'; -import { notRequired, requiredArray } from '../../../util/validate'; +import { requiredArray } from '../../../util/validate'; const getCounterReportsForVersion = (counterVersion) => { return _.filter(counterReports.getOptions(), [ @@ -48,8 +48,8 @@ class SelectedReportsForm extends React.Component { this.props.required && requiredArray(value)} > {({ fields }) => ( { expect(screen.getByRole('textbox', { name: 'Requestor mail' })).not.toBeRequired(); }); + test('saving a named inactive provider', async () => { + const harvestingStatusCombobox = screen.getByRole('combobox', { name: 'Harvesting status' }); + const providerNameTextbox = screen.getByRole('textbox', { name: 'Provider name' }); + const saveAndCloseButton = screen.getByRole('button', { name: 'Save & close' }); + + // status = active && name set + await userEvent.selectOptions(harvestingStatusCombobox, ['active']); + await userEvent.type(providerNameTextbox, 'FooBar'); + expect(harvestingStatusCombobox).toHaveValue('active'); + expect(providerNameTextbox).toHaveValue('FooBar'); + await userEvent.click(saveAndCloseButton); + expect(onSubmit).not.toHaveBeenCalled(); + + // status = inactive && name set + await userEvent.selectOptions(harvestingStatusCombobox, ['inactive']); + expect(harvestingStatusCombobox).toHaveValue('inactive'); + expect(providerNameTextbox).toHaveValue('FooBar'); + await userEvent.click(saveAndCloseButton); + expect(onSubmit).toHaveBeenCalled(); + }); + describe('test required value of customerId field', () => { test('change harvest statistics via from sushi to aggregator', async () => { await userEvent.selectOptions( @@ -450,7 +471,6 @@ describe('UDPForm', () => { const testSelectReportRelease = async (reportRelease) => { renderUDPForm(stripes, reportReleaseProvider); const reqIdBox = screen.getByRole('textbox', { name: 'Requestor ID' }); - // const apiKeyBox = screen.getByRole('textbox', { name: 'API key' }); const releaseSelectBox = screen.getByLabelText('Report release', { exact: false }); expect(reqIdBox).toBeEnabled(); diff --git a/src/settings/Aggregators/DownloadCredentialsButton/DownloadCredentialsButton.js b/src/settings/Aggregators/DownloadCredentialsButton/DownloadCredentialsButton.js index 891384ff..ed7d0ea7 100644 --- a/src/settings/Aggregators/DownloadCredentialsButton/DownloadCredentialsButton.js +++ b/src/settings/Aggregators/DownloadCredentialsButton/DownloadCredentialsButton.js @@ -1,7 +1,7 @@ import React, { useContext } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import { stripesConnect, stripesShape, CalloutContext } from '@folio/stripes/core'; +import { stripesConnect, CalloutContext } from '@folio/stripes/core'; import { Button, Dropdown, @@ -52,7 +52,9 @@ const DownloadCredentialsButton = ({ aggregatorId, stripes }) => { DownloadCredentialsButton.propTypes = { aggregatorId: PropTypes.string.isRequired, - stripes: stripesShape.isRequired, + stripes: PropTypes.shape({ + okapi: PropTypes.object.isRequired, + }).isRequired, }; export default stripesConnect(DownloadCredentialsButton);