0

Im trying to write some test using react testing library/jest

All of the tests pass, but im trying to clean up some warnings..

one of the warnings im getting is

Warning: React does not recognize the staticContext prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase staticcontext instead. If you accidentally passed it from a parent component, remove it from the DOM element.

I did read this thread React wrapper: React does not recognize the `staticContext` prop on a DOM element

but it didn't work.

The page im testing uses an id from the URL to make a graphQL query with apollo ComponentFile

export const ComboStereonet = (props: ReactRouterTypes.RouteComponentProps<RouteParams>) => {
  const serviceFrontId: string = props.match.params.serviceFrontId;
...
...

I wrote some other tests for pages without URL params and dont get this error so

My guess is that it has something to do with how I am providing it with the ID, I couldn't find anything on how to do it properly so I just passed it in as props, which seems kind of hacky... TestFile

 render(
      <MockedProvider mocks={[comboStereonetMockData]} addTypename={false}>
        <ComboStereonet
          match={{
            params: { id: '6058b9dbaa84bc75eed2d1fb', serviceFrontId: '6058b9dbaa84bc75eed2d1fb' }
          }}
        />
      </MockedProvider>,
      {
        wrapper
      }

The wrapper contains a memory router

Thanks for any help.

tomlim8894
  • 11
  • 2

0 Answers0