-
-
Save gasserkl/63095c9b5dd48c632611812c74d8815f 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 return the same user-information upon rerender", async () => { | |
// given: a successful login | |
const { result, rerender } = renderHook(() => useLogin()); | |
act(() => result.current.onLogin("admin", "admin")); | |
await waitFor(() => expect(result.current.isLoginError).toBeFalsy()); | |
await waitFor(() => expect(result.current.loggedInUsername).toEqual("admin")); | |
// when: re-rendering the component | |
rerender(); | |
// then: the user-information is saved | |
expect(result.current.loggedInUsername).toBe("admin"); | |
expect(result.current.isLoginError).toBeFalsy(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment