diff --git a/src/Router.test.tsx b/src/Router.test.tsx index 1929f31..7628121 100644 --- a/src/Router.test.tsx +++ b/src/Router.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import TestRenderer from 'react-test-renderer'; +import { create, act } from 'react-test-renderer'; import { wait } from '@testing-library/react'; import { MemoryRouter } from 'react-router'; @@ -11,7 +11,7 @@ import { Router } from './Router'; jest.mock('./api/Marvel'); function renderRoute(path: string) { - return TestRenderer.create( + return create( @@ -20,7 +20,7 @@ function renderRoute(path: string) { test('HeroesPagination route', async () => { const wrapper = renderRoute('/'); - await wait(); + await act(() => wait()); expect(wrapper.root.findAllByType(HeroesPagination)).toHaveLength(1); expect(wrapper.root.findAllByType(Hero)).toHaveLength(0); expect(wrapper.root.findAllByType(PageNotFound)).toHaveLength(0); @@ -29,7 +29,7 @@ test('HeroesPagination route', async () => { test('Hero route', async () => { const wrapper = renderRoute('/heroes/1011334'); - await wait(); + await act(() => wait()); expect(wrapper.root.findAllByType(HeroesPagination)).toHaveLength(0); expect(wrapper.root.findAllByType(Hero)).toHaveLength(1); expect(wrapper.root.findAllByType(PageNotFound)).toHaveLength(0);