I have tested:
it("login with invalid", async () => {
const handler = jest.fn(e => e.preventDefault())
const { findByTitle, findByText } = render(<Login />)
const email = await findByTitle('Email');
const password = await findByTitle('Password');
const button = await findByText('SIGN IN & SHOP');
await wait(() => {
fireEvent.ionChange(email, '');
});
await wait(() => {
fireEvent.ionChange(password, '');
});
await wait(() => {
fireEvent.submit(button);
});
await expect(handler).toHaveBeenCalled();
await findByText('Required');
});
I have got an error:
How to fix it. Could you help me?
2 posts - 2 participants