I am using jest to do unit testing in my react application.
I have a material ui date picker in my application with next and previous buttons and I have the current selected date in the browser url. Whenever user clicks next or previous button, the url gets updated.
I used history.push to do that and I checked that it's working properly in the ui. But the test case I have to verify this is failing at the following expect statement expect(history.push).toBeCalledWith('/path/to/url?date=${date}'); saying 0 calls are made to this function. I want to retry only this particular expect statement a couple more times if it fails to make sure that it's not failing due to some delay. How can I do that?
retry(expect(history.push).toBeCalledWith('/path/to/url?date=${date}'), numTimes);