-
-
Save gasserkl/bebbd12016e8f830cd7233585b13e9d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("should reset the user information after a subsequent unsuccessful login", async () => { | |
// given: The first login attempt was sucessful | |
const { result } = renderHook(() => useLogin()); | |
act(() => result.current.onLogin("admin", "admin")); | |
await waitFor(() => expect(result.current.isLoginError).toBeFalsy()); | |
await waitFor(() => expect(result.current.loggedInUsername).toEqual("admin")); | |
// when: login in again with invalid credentials | |
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