Description: The component CreateOrEditOffer.tsx includes functionality to handle responses and errors from the useAxios hook through the onResponse and onError callbacks. To ensure these callbacks work as expected, unit tests need to be written.
onResponse:
Simulate a successful Axios request using the mocked useAxios hook;
Verify that the onResponse callback is called with the correct data;
Ensure the component dispatches the correct openAlert message and navigates to the right url.
onError:
Simulate a failed Axios request using the mocked useAxios hook;
Verify that the onError callback is triggered;
Ensure the component dispatches the correct openAlert message.
Description: The component
CreateOrEditOffer.tsx
includes functionality to handle responses and errors from theuseAxios
hook through theonResponse
andonError
callbacks. To ensure these callbacks work as expected, unit tests need to be written.onResponse
:openAlert
message and navigates to the right url.onError
:openAlert
message.Code coverage right now: