Skip to content

Instantly share code, notes, and snippets.

@ivan-ha
Created June 1, 2019 10:00
Show Gist options
  • Save ivan-ha/dd0950000f215f61c526ef59123c852a to your computer and use it in GitHub Desktop.
Save ivan-ha/dd0950000f215f61c526ef59123c852a to your computer and use it in GitHub Desktop.
react-hooks-test-failed-unit-test
jest.mock("axios");
describe("useRandomUsers", () => {
it("call API and return results", async () => {
axios.mockImplementation(() => Promise.resolve({ data: mockResponse }));
const users = useRandomUsers();
expect(users.current).toStrictEqual(mockResponse);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment