Closed atk closed 1 year ago
This does not work for me.
it('can render a route with the id', async () => {
const { findByText } = render(() => <App />, { location: '/ids/1234' })
expect(await findByText('Id: 1234')).not.toBeFalsy()
})
Gives:
FAIL src/test/pages/Drone-view.test.tsx > location option > can render a route with the id
TestingLibraryElementError: Unable to find an element with the text: Id: 1234. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
A common use case is to test an app that requires a predefined router for different paths. To make the setup more convenient, this comes with a new
location
option that makesrender
setup a router and navigate to the location.