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

I have test code like this:

test("Test", () => {
   render(<App />);
})

However, I’m getting the following error:

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

When testing, code that causes React state updates should be wrapped into act(...):

act(() => {
  /* fire events that update state */
});
/* assert on the output */

What should I do to eliminate these warnings?

This may be caused by this issue from the Testing Library. Simply speaking, the cause is that React states are still getting updated even after the test has ended.

One solution is to explicitly unmount the app before the end of the test:

test('Test', () => {
  const { unmount } = render(<App/>);
  unmount();
})