-
Notifications
You must be signed in to change notification settings - Fork 80
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
1 parent
6187a96
commit 0146c70
Showing
12 changed files
with
148 additions
and
48 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
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,4 +1,4 @@ | ||
export const getStudioHomeData = (state) => state.studioHome.studioHomeData; | ||
export const getStudioHomeData = (state) => state.studioHome?.studioHomeData; | ||
export const getLoadingStatuses = (state) => state.studioHome.loadingStatuses; | ||
export const getSavingStatuses = (state) => state.studioHome.savingStatuses; | ||
export const getStudioHomeCoursesParams = (state) => state.studioHome.studioHomeCoursesRequestParams; |
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,27 @@ | ||
/** | ||
* Retrieves the waffle flag configuration based on the provided result object. | ||
* | ||
* @param {Object} result - The result object containing waffle flags. | ||
* @param {Object} result.waffleFlags - The waffle flags for feature toggling. | ||
* @returns {Object} The configuration object with feature toggles. | ||
*/ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const getWaffleFlagsConfig = ({ waffleFlags = {} }) => ({ | ||
ENABLE_NEW_SCHEDULE_AND_DETAILS_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewScheduleDetailsPage ?? false, | ||
ENABLE_NEW_GRADING_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewGradingPage ?? false, | ||
ENABLE_NEW_COURSE_TEAM_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewCourseTeamPage ?? false, | ||
ENABLE_NEW_GROUP_CONFIGURATIONS_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewGroupConfigurationsPage ?? false, | ||
ENABLE_NEW_ADVANCED_SETTINGS_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewAdvancedSettingsPage ?? false, | ||
ENABLE_NEW_COURSE_OUTLINE_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewCourseOutlinePage ?? false, | ||
ENABLE_NEW_COURSE_UPDATES_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewUpdatesPage ?? false, | ||
ENABLE_NEW_FILE_UPLOAD_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewFilesUploadsPage ?? false, | ||
ENABLE_NEW_PAGES_AND_RESOURCES_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewCustomPages ?? false, | ||
ENABLE_NEW_IMPORT_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewImportPage ?? false, | ||
ENABLE_NEW_EXPORT_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewExportPage ?? false, | ||
ENABLE_NEW_HOME_PAGE: waffleFlags.newStudioMfeUseNewHomePage ?? false, | ||
ENABLE_NEW_TEXTBOOKS_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewTextbooksPage ?? false, | ||
ENABLE_NEW_CUSTOM_PAGES: waffleFlags.contentstoreNewStudioMfeUseNewCustomPages ?? false, | ||
ENABLE_NEW_VIDEO_UPLOAD_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewVideoUploadsPage ?? false, | ||
ENABLE_NEW_CERTIFICATES_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewCertificatesPage ?? false, | ||
ENABLE_NEW_UNIT_PAGE: waffleFlags.contentstoreNewStudioMfeUseNewUnitPage ?? false, | ||
}); |
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,11 +1,15 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { getAuthenticatedUser } from '@edx/frontend-platform/auth'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { initializeMockApp } from '@edx/frontend-platform'; | ||
import { AppProvider } from '@edx/frontend-platform/react'; | ||
|
||
import initializeStore from '../../store'; | ||
import messages from './messages'; | ||
import VerifyEmailLayout from '.'; | ||
|
||
let store; | ||
|
||
const mockPathname = '/foo-bar'; | ||
const fakeAuthenticatedUser = { | ||
email: '[email protected]', | ||
|
@@ -18,28 +22,52 @@ jest.mock('react-router-dom', () => ({ | |
pathname: mockPathname, | ||
}), | ||
})); | ||
|
||
jest.mock('@edx/frontend-platform/auth'); | ||
|
||
getAuthenticatedUser.mockImplementation(() => fakeAuthenticatedUser); | ||
|
||
const RootWrapper = () => ( | ||
<IntlProvider locale="en" messages={{}}> | ||
<VerifyEmailLayout /> | ||
<AppProvider store={store}> | ||
<VerifyEmailLayout /> | ||
</AppProvider> | ||
</IntlProvider> | ||
); | ||
|
||
describe('<VerifyEmailLayout />', () => { | ||
beforeEach(async () => { | ||
initializeMockApp({ | ||
authenticatedUser: { | ||
userId: 3, | ||
username: 'abc123', | ||
administrator: false, | ||
roles: [], | ||
}, | ||
}); | ||
|
||
store = initializeStore({ | ||
courseDetail: { | ||
courseId: 'id', | ||
status: 'sucessful', | ||
}, | ||
}); | ||
}); | ||
|
||
it('renders successfully', () => { | ||
const { getByText } = render(<RootWrapper />); | ||
|
||
expect( | ||
getByText(`Thanks for signing up, ${fakeAuthenticatedUser.username}!`, { | ||
exact: false, | ||
}), | ||
).toBeInTheDocument(); | ||
expect(getByText(messages.bannerTitle.defaultMessage)).toBeInTheDocument(); | ||
|
||
expect(getByText( | ||
`Almost there! In order to complete your sign up we need you to verify your email address (${fakeAuthenticatedUser.email}). An activation message and next steps should be waiting for you there.`, | ||
{ exact: false }, | ||
)).toBeInTheDocument(); | ||
|
||
expect(getByText(messages.sidebarTitle.defaultMessage)).toBeInTheDocument(); | ||
expect(getByText(messages.sidebarDescription.defaultMessage)).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