You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// in test utilsconstcustomRender=(ui: ReactElement,apolloMocks?: ApolloMocks,options?: Omit<RenderOptions,'wrapper'>)=>render(ui,{wrapper: ()=>ui,// this would include our providers wrapped around ui but this demonstrates the issue in a cleaner way
...options,});// in test fileconstComp=({ number }: {number: number})=><p>{number}</p>;it('check render',()=>{const{ rerender }=customRender(<Compnumber={1}/>);rerender(<Compnumber={2}/>);expect(screen.getByText('2')).toBeInTheDocument();});
What you did:
Rerendering a component that was originally rendered out with the wrapper option, combining two different guides in the docs.
What happened:
No props are updated. The component does rerender, however it does so with the "old" props. (So in the example above, the test fails because 1 is present instead of 2.)
Reproduction:
Happy to add this if necessary.
Problem description:
We can't actually re-render stuff :) The workaround we're using is to put the wrapper directly into the test but that sort of defeats having any wrapper to begin with.
Suggested solution:
Not sure how the internals work and why the wrapper would interfere with the props. I imagine we'd need to see why the props aren't being passed correctly and fix it on that level.
The text was updated successfully, but these errors were encountered:
@testing-library/react
version: 13.4.0Relevant code or config:
What you did:
Rerendering a component that was originally rendered out with the wrapper option, combining two different guides in the docs.
What happened:
No props are updated. The component does rerender, however it does so with the "old" props. (So in the example above, the test fails because
1
is present instead of2
.)Reproduction:
Happy to add this if necessary.
Problem description:
We can't actually re-render stuff :) The workaround we're using is to put the wrapper directly into the test but that sort of defeats having any wrapper to begin with.
Suggested solution:
Not sure how the internals work and why the wrapper would interfere with the props. I imagine we'd need to see why the props aren't being passed correctly and fix it on that level.
The text was updated successfully, but these errors were encountered: