Skip to content

Instantly share code, notes, and snippets.

@enzzoperez
Created April 18, 2022 16:34
Show Gist options
  • Save enzzoperez/582fca223d5401e3a41c0f3ab4eb008b to your computer and use it in GitHub Desktop.
Save enzzoperez/582fca223d5401e3a41c0f3ab4eb008b to your computer and use it in GitHub Desktop.
it('testing success get request', async () => {
const mock = new MockAdapter(axios);
mock.onGet().reply(200, {data: []});
const {result, waitForNextUpdate} = renderHook(
({url}) => useRemoteData({url}),
{
initialProps: {
url: '',
},
},
);
await waitForNextUpdate();
expect(result.current.response).toBeTruthy();
expect(result.current.loading).toBeFalsy();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment