Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new location option to setup router #40

Merged
merged 1 commit into from
Jun 20, 2023
Merged

new location option to setup router #40

merged 1 commit into from
Jun 20, 2023

Conversation

atk
Copy link
Collaborator

@atk atk commented Jun 19, 2023

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 makes render setup a router and navigate to the location.

@atk atk merged commit 349c957 into main Jun 20, 2023
@atk atk deleted the router-setup branch June 20, 2023 09:06
@Minoo7
Copy link

Minoo7 commented Apr 10, 2024

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.

@paularmstrong
Copy link

Related: #60 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants