generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
7 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
22 changes: 22 additions & 0 deletions
22
src/features/Dashboard/DashboardPage/_test_/index.test.jsx
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,22 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import DashboardPage from 'features/Dashboard/DashboardPage'; | ||
import { InstitutionContext } from 'features/Main/institutionContext'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
|
||
describe('DashboardPage component', () => { | ||
test('renders components', () => { | ||
const { getByText } = render( | ||
<InstitutionContext.Provider value={[{ id: 1, name: 'Institution Name' }]}> | ||
<DashboardPage /> | ||
</InstitutionContext.Provider>, | ||
); | ||
|
||
expect(getByText('This week')).toBeInTheDocument(); | ||
expect(getByText('Next week')).toBeInTheDocument(); | ||
expect(getByText('Next month')).toBeInTheDocument(); | ||
expect(getByText('New students registered')).toBeInTheDocument(); | ||
expect(getByText('Classes scheduled')).toBeInTheDocument(); | ||
expect(getByText('Welcome to Institution Name')).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useContext } from 'react'; | ||
import { Container } from '@edx/paragon'; | ||
import StudentsMetrics from 'features/Students/StudentsMetrics'; | ||
import { InstitutionContext } from 'features/Main/institutionContext'; | ||
|
||
const DashboardPage = () => { | ||
const dataInstitution = useContext(InstitutionContext); | ||
|
||
return ( | ||
<Container size="xl"> | ||
<h2 className="title-page">{dataInstitution.length === 1 ? `Welcome to ${dataInstitution[0].name}` : 'Select an institution'}</h2> | ||
<StudentsMetrics /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default DashboardPage; |
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