enabled not working on testing

I am trying to test a component that relies on a useQuery hook. For other tests this works fine, however for the component that has the enabled flag set I don't get any data from the useQuery hook and also isLoading stays true.

The strange thing is that when I log the enabled value it is logged as true but the test doesn't pass.

If I however uncomment the enabled flag my test passes šŸ¤·šŸ¼ā€ā™‚ļø


See printscreen. Is there anything special I need to do when enabled flag is set to make my test pass?

It's like in the test after enabled is true there is no more render anymore so I don't get the data

this is my test



    const { findByText } = render(
      <MonitorPeak setShowFluvius={jest.fn()} showFluvius={showState.data} />,
    )

    await findByText(/BasicMonitoringScreen.consumptionPeak/)


and see screenshot of my useQueryhook
CleanShot_2023-08-11_at_15.36.042x.png
Was this page helpful?