Skip to content

Commit

Permalink
Rewrite test to use userEvent over fireEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
wjames111 committed Sep 23, 2024
1 parent e33f59a commit 8a76903
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/Tool/FixCommitmentInfo/Contact.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,15 @@ describe('FixCommitmentContact', () => {
expect(await findByTestId('pledgeFrequency-input')).toHaveValue('');
});
it('Change pledgeCurrencies', async () => {
const { findByTestId, getByTestId } = render(
const { findByTestId, getByRole } = render(
<TestRouter router={router}>
<TestComponent statuses={['Partner - Financial', 'test_option_1']} />
</TestRouter>,
);
expect(await findByTestId('pledgeCurrency-input')).toBeInTheDocument();

fireEvent.click(getByTestId('pledgeCurrency-input'));
fireEvent.change(getByTestId('pledgeCurrency-input'), {
target: { value: 'CDF (CDF)' },
});
const CurrencyField = getByRole('combobox', { name: 'Currency' });
userEvent.click(CurrencyField);
userEvent.click(getByRole('option', { name: 'CDF (CDF)' }));
expect(CurrencyField).toHaveTextContent('CDF (CDF)');
});
});

0 comments on commit 8a76903

Please sign in to comment.