0

Warning: An update to Form inside a test was not wrapped in act(...).

test('should watch input correctly', async () => {
  const { container } = render(<Form />);
  const password = container.querySelector("input[name='password']");
  const repeatPassword = container.querySelector(
    "input[name='repeatPassword']",
  );

  await act(async () => {
    fireEvent.input(password, {
      target: {
        value: 'Test2020.1',
      },
    });
  });

  await act(async () => {
    fireEvent.input(repeatPassword, {
      target: {
        value: 'Test2020.1',
      },
    });
  });

  expect(password.value).toEqual('Test2020.1');
  expect(repeatPassword.value).toEqual('Test2020.1');
});

I been reading a lot at this known issue but I cant find a solution. Im using react-hook-form to take the values.

Jacoborope
  • 13
  • 3
  • This is just warning. https://stackoverflow.com/questions/60115885/how-to-solve-the-update-was-not-wrapped-in-act-warning-in-testing-library-re – Sarun UK Oct 30 '20 at 10:23

0 Answers0