-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update tests with act with lint issues
- Loading branch information
1 parent
e6b2390
commit c5588aa
Showing
7 changed files
with
63 additions
and
42 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import React from 'react'; | ||
import { cleanup, fireEvent, render, RenderResult, screen } from '@testing-library/react'; | ||
import { act, cleanup, fireEvent, render, RenderResult, screen } from '@testing-library/react'; | ||
import { ForgotPasswordScreenProps } from './types'; | ||
import { AuthContextProvider } from '../../contexts'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
|
@@ -75,7 +75,7 @@ describe('Forgot Password Screen tests', () => { | |
expect(mockOnPrevious).toHaveBeenCalled(); | ||
}); | ||
|
||
it('firing onNext Callback functions', () => { | ||
it('firing onNext Callback functions', async () => { | ||
const { getByLabelText } = renderer({ | ||
WorkflowCardActionsProps: { | ||
canGoNext: true, | ||
|
@@ -95,7 +95,9 @@ describe('Forgot Password Screen tests', () => { | |
|
||
expect(nextButton).toBeInTheDocument(); | ||
expect(screen.getByText(/Next/i)).toBeEnabled(); | ||
fireEvent.click(nextButton); | ||
await act(async () => { | ||
fireEvent.click(nextButton); | ||
}); | ||
expect(mockOnNext).toHaveBeenCalled(); | ||
}); | ||
|
||
|
@@ -121,7 +123,7 @@ describe('Forgot Password Screen tests', () => { | |
expect(successMessage).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not show success screen, when showSuccessScreen is false', () => { | ||
it('should not show success screen, when showSuccessScreen is false', async () => { | ||
const { getByLabelText } = render( | ||
<AuthContextProvider {...authContextProviderProps}> | ||
<BrowserRouter> | ||
|
@@ -137,7 +139,9 @@ describe('Forgot Password Screen tests', () => { | |
expect(emailInput).toHaveValue('[email protected]'); | ||
expect(nextButton).toBeInTheDocument(); | ||
expect(screen.getByText(/Submit/i)).toBeEnabled(); | ||
fireEvent.click(nextButton); | ||
await act(async () => { | ||
fireEvent.click(nextButton); | ||
}); | ||
|
||
const successMessage = screen.queryByText('Email Sent'); | ||
expect(successMessage).toBeNull(); | ||
|
@@ -159,7 +163,9 @@ describe('Forgot Password Screen tests', () => { | |
expect(emailInput).toHaveValue('[email protected]'); | ||
expect(nextButton).toBeInTheDocument(); | ||
expect(screen.getByText(/Submit/i)).toBeEnabled(); | ||
fireEvent.click(nextButton); | ||
await act(async () => { | ||
fireEvent.click(nextButton); | ||
}); | ||
|
||
const successMessage = await screen.findByText('Success'); | ||
expect(successMessage).toBeInTheDocument(); | ||
|
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