uwazi icon indicating copy to clipboard operation
uwazi copied to clipboard

Migrate test of functional components that are using useEffect hook from Enzime to React Testing Library

Open mfacar opened this issue 2 years ago • 1 comments

The early tests of functional components that include useEffect hook, written with Enzime, are tossing the warning Warning: An update to %s inside a test was not wrapped in act(... which at the moment means thousands of lines in the output at finishing the app-unit-tests suite. This makes it pretty difficult to read the output and increases the size of the log files unnecessarily.

To avoid the warning it is necessary to migrate the tests from Enzime to React Testing Library, which includes the use of renderConnectedContainer for rendering, and wrap the actions that trigger useEffect into the act function, i.e. act(() => { fireEvent.click(saveButton); });

mfacar avatar Aug 25 '22 16:08 mfacar

#5040 can be taken as a reference for the required migration.

mfacar avatar Aug 26 '22 01:08 mfacar