generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrected loading issue and extra space in standup submit (#1230)
Co-authored-by: Shubham Sharma <shbh541@gmail.com>
- Loading branch information
1 parent
df3401c
commit 578749f
Showing
6 changed files
with
133 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { setupServer } from 'msw/node'; | ||
import handlers from '../../../../__mocks__/handlers'; | ||
import MainForm from '@/components/standup/MainForm'; | ||
import { renderWithRouter } from '@/test_utils/createMockRouter'; | ||
import { Provider } from 'react-redux'; | ||
import { store } from '@/app/store'; | ||
import { screen, waitFor } from '@testing-library/react'; | ||
|
||
const server = setupServer(...handlers); | ||
|
||
describe('MainFOrm', () => { | ||
beforeAll(() => { | ||
server.listen(); | ||
}); | ||
afterEach(() => { | ||
server.resetHandlers(); | ||
}); | ||
afterAll(() => { | ||
server.close(); | ||
}); | ||
|
||
test('If isFormVisible is true it should render form for standup. ', async () => { | ||
renderWithRouter( | ||
<Provider store={store()}> | ||
<MainForm isFormVisible={true} /> | ||
</Provider> | ||
); | ||
|
||
await waitFor(() => | ||
expect(screen.getByRole('form')).toBeInTheDocument() | ||
); | ||
}); | ||
test('If isFormVisible is false it should render form for standup. ', async () => { | ||
renderWithRouter( | ||
<Provider store={store()}> | ||
<MainForm isFormVisible={false} /> | ||
</Provider> | ||
); | ||
|
||
await waitFor(() => | ||
expect( | ||
screen.getByText( | ||
'Your standup for the day has already been submitted, please fill out the form tomorrow after 6:00 a.m.' | ||
) | ||
).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
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,17 @@ | ||
import FormInputComponent from './FormInputComponent'; | ||
import styles from '@/components/standup/standupContainer.module.scss'; | ||
|
||
const MainForm = ({ isFormVisible }: { isFormVisible: boolean }) => { | ||
if (isFormVisible) { | ||
return <FormInputComponent />; | ||
} else { | ||
return ( | ||
<p className={styles.formFilledMessage}> | ||
Your standup for the day has already been submitted, please fill | ||
out the form tomorrow after 6:00 a.m. | ||
</p> | ||
); | ||
} | ||
}; | ||
|
||
export default MainForm; |
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