Skip to content

Instantly share code, notes, and snippets.

@gasserkl
Created September 8, 2021 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gasserkl/e0ef3cd82a8b06e1eab09379a57b507b to your computer and use it in GitHub Desktop.
Save gasserkl/e0ef3cd82a8b06e1eab09379a57b507b to your computer and use it in GitHub Desktop.
it("should return and error upon unsuccessful login", async () => {
// when:
const { result } = renderHook(() => useLogin());
act(() => result.current.onLogin("admin", "incorrect-password"));
// then:
await waitFor(() => expect(result.current.isLoginError).toBeTruthy());
await waitFor(() => expect(result.current.loggedInUsername).toBeUndefined());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment