-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Seedless-Onboarding] Refactor context + provider into service class (#…
…2695) Co-authored-by: Usame Algan <[email protected]>
- Loading branch information
1 parent
0666620
commit abdc544
Showing
41 changed files
with
1,055 additions
and
850 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
136 changes: 0 additions & 136 deletions
136
src/components/common/ConnectWallet/__tests__/MPCLogin.test.tsx
This file was deleted.
Oops, something went wrong.
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
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
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
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
48 changes: 48 additions & 0 deletions
48
src/components/common/SocialSigner/__tests__/PasswordRecovery.test.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { fireEvent, render } from '@/tests/test-utils' | ||
import { PasswordRecovery } from '@/components/common/SocialSigner/PasswordRecovery' | ||
import { act, waitFor } from '@testing-library/react' | ||
|
||
describe('PasswordRecovery', () => { | ||
it('displays an error if password is wrong', async () => { | ||
const mockRecoverWithPassword = jest.fn(() => Promise.reject()) | ||
const mockOnSuccess = jest.fn() | ||
|
||
const { getByText, getByLabelText } = render( | ||
<PasswordRecovery recoverFactorWithPassword={mockRecoverWithPassword} onSuccess={mockOnSuccess} />, | ||
) | ||
|
||
const passwordField = getByLabelText('Recovery password') | ||
const submitButton = getByText('Submit') | ||
|
||
act(() => { | ||
fireEvent.change(passwordField, { target: { value: 'somethingwrong' } }) | ||
submitButton.click() | ||
}) | ||
|
||
await waitFor(() => { | ||
expect(mockOnSuccess).not.toHaveBeenCalled() | ||
expect(getByText('Incorrect password')).toBeInTheDocument() | ||
}) | ||
}) | ||
|
||
it('calls onSuccess if password is correct', async () => { | ||
const mockRecoverWithPassword = jest.fn(() => Promise.resolve()) | ||
const mockOnSuccess = jest.fn() | ||
|
||
const { getByText, getByLabelText } = render( | ||
<PasswordRecovery recoverFactorWithPassword={mockRecoverWithPassword} onSuccess={mockOnSuccess} />, | ||
) | ||
|
||
const passwordField = getByLabelText('Recovery password') | ||
const submitButton = getByText('Submit') | ||
|
||
act(() => { | ||
fireEvent.change(passwordField, { target: { value: 'somethingCorrect' } }) | ||
submitButton.click() | ||
}) | ||
|
||
await waitFor(() => { | ||
expect(mockOnSuccess).toHaveBeenCalled() | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.