uwazi
uwazi copied to clipboard
Migrate test of functional components that are using useEffect hook from Enzime to React Testing Library
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); });
#5040 can be taken as a reference for the required migration.