Skip to content

Commit

Permalink
fixing test to pass with node 18 (#491)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
  • Loading branch information
amitgalitz authored May 24, 2023
1 parent 710e3c4 commit 93ba127
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ describe('<NameAndDescription /> spec', () => {
expect(container.firstChild).toMatchSnapshot();
});
test('shows error for detector name input when toggling focus/blur', async () => {
const handleValidateName = jest.fn().mockImplementation(() => {
throw 'Required';
const handleValidateName = jest.fn().mockImplementationOnce(() => {
return 'Required';
});
const { queryByText, findByText, getByPlaceholderText } = render(
<Formik initialValues={{ name: '' }} onSubmit={jest.fn()}>
<Formik
initialValues={{ name: '', description: 'one' }}
onSubmit={jest.fn()}
>
{() => (
<div>
<NameAndDescription onValidateDetectorName={handleValidateName} />
Expand All @@ -49,6 +52,7 @@ describe('<NameAndDescription /> spec', () => {
expect(handleValidateName).toHaveBeenCalledTimes(1);
expect(findByText('Required')).not.toBeNull();
});

test('shows error for detector description input when toggling focus/bur', async () => {
const { queryByText, findByText, getByPlaceholderText } = render(
<Formik
Expand Down

0 comments on commit 93ba127

Please sign in to comment.