Я читаю этот урок. https://testing-library.com/docs/example-react-router
Я слежу за делом "Полный рендеринг приложения / навигация" и не могу заставить щелчок работать.
test('full app rendering/navigating', () => {
const history = createMemoryHistory()
const { container, getByText } = render(
<Router history={history}>
<App />
</Router>
)
// verify page content for expected route
// often you'd use a data-testid or role query, but this is also possible
expect(container.innerHTML).toMatch('You are home')
fireEvent.click(getByText(/about/i))
// check that the content changed to the new page
expect(container.innerHTML).toMatch('You are on the about page')
})
Даже когда я нажимаю, я все равно остаюсь на той же странице, и содержимое «контейнера» не изменяется.