Closed
Description
Describe the feature you'd like:
I'd like to be able to write a passing test that verifies that when I fireEvent
, an error is thrown. This test fails before it reaches the expect
:
test('error is thrown', async () => {
const { getByText } = render(<TodoApp />)
await waitForDomChange();
fireEvent.click(getByText('Add todo'));
// test fails during this line
await waitForDomChange();
expect(1).toBeTruthy();
})
I'd like something to the effect of:
test('error is thrown', async () => {
const { getByText } = render(<TodoApp />)
await waitForDomChange();
fireEvent.click(getByText('Add todo'));
expect(await waitForDomChange()).toThrow();
})
Describe alternatives you've considered:
Adding an <ErrorBoundary>
and testing both components together.