diff --git a/site.config.test.tsx b/site.config.test.tsx index 2a1a3279..666226b5 100644 --- a/site.config.test.tsx +++ b/site.config.test.tsx @@ -1,5 +1,7 @@ import { EnvironmentTypes, SiteConfig } from '@openedx/frontend-base'; +import { appId } from './src/constants'; + const siteConfig: SiteConfig = { siteId: 'test-site', siteName: 'Test Site', @@ -10,7 +12,7 @@ const siteConfig: SiteConfig = { environment: EnvironmentTypes.TEST, apps: [{ - appId: 'test-app', + appId, config: { ACTIVATION_EMAIL_SUPPORT_LINK: null, ALLOW_PUBLIC_ACCOUNT_CREATION: false, diff --git a/src/Main.tsx b/src/Main.tsx index 070f5727..514dc44a 100755 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -2,7 +2,7 @@ import { Provider as ReduxProvider } from 'react-redux'; import { Outlet } from 'react-router-dom'; import { CurrentAppProvider } from '@openedx/frontend-base'; -import { appId } from './app'; +import { appId } from './constants'; import { registerIcons, } from './common-components'; diff --git a/src/app.ts b/src/app.ts index 767964fb..4f7c61f5 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,9 +1,8 @@ import { App } from '@openedx/frontend-base'; +import { appId } from './constants'; import routes from './routes'; import messages from './i18n'; -export const appId = 'org.openedx.frontend.app.authn'; - const app: App = { appId, routes, diff --git a/src/base-container/tests/BaseContainer.test.jsx b/src/base-container/tests/BaseContainer.test.jsx index aa530393..c2968e08 100644 --- a/src/base-container/tests/BaseContainer.test.jsx +++ b/src/base-container/tests/BaseContainer.test.jsx @@ -3,7 +3,7 @@ import { render } from '@testing-library/react'; import { Context as ResponsiveContext } from 'react-responsive'; import BaseContainer from '../index'; -import { testAppId } from '../../setupTest'; +import { appId } from '../../constants'; const LargeScreen = { wrappingComponent: ResponsiveContext.Provider, @@ -26,7 +26,7 @@ describe('Base component tests', () => { }); it('renders Image layout when ENABLE_IMAGE_LAYOUT configuration is enabled', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_IMAGE_LAYOUT: true, }); diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 00000000..40099391 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1 @@ +export const appId = 'org.openedx.frontend.app.authn'; diff --git a/src/forgot-password/tests/ForgotPasswordPage.test.jsx b/src/forgot-password/tests/ForgotPasswordPage.test.jsx index 3fdea9a8..4ecee3e3 100644 --- a/src/forgot-password/tests/ForgotPasswordPage.test.jsx +++ b/src/forgot-password/tests/ForgotPasswordPage.test.jsx @@ -11,7 +11,7 @@ import configureStore from 'redux-mock-store'; import { INTERNAL_SERVER_ERROR, LOGIN_PAGE } from '../../data/constants'; import { PASSWORD_RESET } from '../../reset-password/data/constants'; -import { testAppId } from '../../setupTest'; +import { appId } from '../../constants'; import { setForgotPasswordFormData } from '../data/actions'; import ForgotPasswordPage from '../ForgotPasswordPage'; @@ -42,7 +42,7 @@ const initialState = { }; describe('ForgotPasswordPage', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { LOGIN_ISSUE_SUPPORT_LINK: '', INFO_EMAIL: '', }); @@ -80,7 +80,7 @@ describe('ForgotPasswordPage', () => { }); it('should display need other help signing in button', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { LOGIN_ISSUE_SUPPORT_LINK: '/support', }); render(reduxWrapper()); diff --git a/src/login/tests/AccountActivationMessage.test.jsx b/src/login/tests/AccountActivationMessage.test.jsx index 868c533f..027061fb 100644 --- a/src/login/tests/AccountActivationMessage.test.jsx +++ b/src/login/tests/AccountActivationMessage.test.jsx @@ -4,14 +4,14 @@ import { } from '@testing-library/react'; -import { testAppId } from '../../setupTest'; +import { appId } from '../../constants'; import { ACCOUNT_ACTIVATION_MESSAGE } from '../data/constants'; import AccountActivationMessage from '../AccountActivationMessage'; const IntlAccountActivationMessage = injectIntl(AccountActivationMessage); const providerWrapper = children => ( - + {children} diff --git a/src/login/tests/LoginFailure.test.jsx b/src/login/tests/LoginFailure.test.jsx index 3125c6b0..88697ad6 100644 --- a/src/login/tests/LoginFailure.test.jsx +++ b/src/login/tests/LoginFailure.test.jsx @@ -4,7 +4,7 @@ import { } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; -import { testAppId, initializeMockServices } from '../../setupTest'; +import { appId } from '../../constants'; import { ACCOUNT_LOCKED_OUT, ALLOWED_DOMAIN_LOGIN_ERROR, @@ -29,7 +29,7 @@ jest.mock('@openedx/frontend-base', () => ({ const IntlLoginFailureMessage = injectIntl(LoginFailureMessage); const providerWrapper = children => ( - + {children} diff --git a/src/login/tests/LoginPage.test.jsx b/src/login/tests/LoginPage.test.jsx index 7770f00d..8506c51d 100644 --- a/src/login/tests/LoginPage.test.jsx +++ b/src/login/tests/LoginPage.test.jsx @@ -10,7 +10,8 @@ import { act } from 'react-dom/test-utils'; import { MemoryRouter } from 'react-router-dom'; import configureStore from 'redux-mock-store'; -import { initializeMockServices, testAppId } from '../../setupTest'; +import { appId } from '../../constants'; +import { initializeMockServices } from '../../setupTest'; import { COMPLETE_STATE, LOGIN_PAGE, PENDING_STATE } from '../../data/constants'; import { backupLoginFormBegin, dismissPasswordResetBanner, loginRequest } from '../data/actions'; import { INTERNAL_SERVER_ERROR } from '../data/constants'; @@ -30,7 +31,7 @@ describe('LoginPage', () => { const reduxWrapper = children => ( - + {children} @@ -85,7 +86,7 @@ describe('LoginPage', () => { it('should submit form for valid input', () => { store.dispatch = jest.fn(store.dispatch); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); @@ -272,7 +273,7 @@ describe('LoginPage', () => { { selector: `#${ssoProvider.id}` }, )).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); @@ -337,7 +338,7 @@ describe('LoginPage', () => { // ******** test enterprise login disabled scenarios ******** it('should show sign-in header for institution login if enterprise login is disabled', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: true, }); @@ -358,13 +359,13 @@ describe('LoginPage', () => { expect(queryByText('Company or school credentials')).toBeNull(); expect(queryByText('Institution/campus credentials')).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); it('should show sign-in header with secondary Providers and without Providers', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: true, }); @@ -385,7 +386,7 @@ describe('LoginPage', () => { expect(queryByText('Or sign in with:')).toBeDefined(); expect(queryByText('Institution/campus credentials')).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); @@ -424,7 +425,7 @@ describe('LoginPage', () => { expect(queryByText('Company or school credentials')).toBeNull(); expect(queryByText('Institution/campus credentials')).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); @@ -694,7 +695,7 @@ describe('LoginPage', () => { const { container } = render(reduxWrapper()); expect(container.querySelector(`#${ssoProvider.id}`).querySelector('#provider-name').textContent).toEqual(`${ssoProvider.name}`); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); @@ -712,7 +713,7 @@ describe('LoginPage', () => { }, }); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ALLOW_PUBLIC_ACCOUNT_CREATION: true, SHOW_REGISTRATION_LINKS: true, }); @@ -727,7 +728,7 @@ describe('LoginPage', () => { }); it('should render other ways to sign in button when public account creation is disabled', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ALLOW_PUBLIC_ACCOUNT_CREATION: false, }); diff --git a/src/logistration/Logistration.test.jsx b/src/logistration/Logistration.test.jsx index 7717fc68..e07106c0 100644 --- a/src/logistration/Logistration.test.jsx +++ b/src/logistration/Logistration.test.jsx @@ -7,7 +7,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import configureStore from 'redux-mock-store'; -import { testAppId } from '../setupTest'; +import { appId } from '../constants'; import { clearThirdPartyAuthContextErrorMessage } from '../common-components/data/actions'; import { COMPLETE_STATE, LOGIN_PAGE, REGISTER_PAGE, @@ -43,7 +43,7 @@ describe('Logistration', () => { const reduxWrapper = children => ( - + {children} @@ -91,7 +91,7 @@ describe('Logistration', () => { }); it('should render registration page', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ALLOW_PUBLIC_ACCOUNT_CREATION: true, }); @@ -108,7 +108,7 @@ describe('Logistration', () => { }); it('should render login/register headings when show registration links is disabled', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ALLOW_PUBLIC_ACCOUNT_CREATION: true, SHOW_REGISTRATION_LINKS: false, }); @@ -129,7 +129,7 @@ describe('Logistration', () => { }); it('should render only login page when public account creation is disabled', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ALLOW_PUBLIC_ACCOUNT_CREATION: false, DISABLE_ENTERPRISE_LOGIN: 'true', SHOW_REGISTRATION_LINKS: 'true', @@ -160,7 +160,7 @@ describe('Logistration', () => { }); it('should display institution login option when secondary providers are present', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: 'true', ALLOW_PUBLIC_ACCOUNT_CREATION: 'true', }); @@ -186,13 +186,13 @@ describe('Logistration', () => { fireEvent.click(screen.getByText('Institution/campus credentials')); expect(screen.getByText('Test University')).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); it('send tracking and page events when institutional login button is clicked', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: 'true', }); @@ -216,13 +216,13 @@ describe('Logistration', () => { expect(sendTrackEvent).toHaveBeenCalledWith('edx.bi.institution_login_form.toggled', { category: 'user-engagement' }); expect(sendPageEvent).toHaveBeenCalledWith('login_and_registration', 'institution_login'); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); it('should not display institution register button', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: 'true', }); @@ -246,7 +246,7 @@ describe('Logistration', () => { fireEvent.click(screen.getByText('Institution/campus credentials')); expect(screen.getByText('Test University')).toBeDefined(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { DISABLE_ENTERPRISE_LOGIN: '', }); }); diff --git a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx index 5fafdb16..2e655db0 100644 --- a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx +++ b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx @@ -17,7 +17,7 @@ import { import { MemoryRouter, mockNavigate, useLocation } from 'react-router-dom'; import configureStore from 'redux-mock-store'; -import { testAppId } from '../../setupTest'; +import { appId } from '../../constants'; import { AUTHN_PROGRESSIVE_PROFILING, COMPLETE_STATE, DEFAULT_REDIRECT_URL, @@ -87,7 +87,7 @@ describe('ProgressiveProfilingTests', () => { const reduxWrapper = children => ( - + {children} @@ -111,7 +111,7 @@ describe('ProgressiveProfilingTests', () => { // ******** test form links and modal ******** it('should not display button "Learn more about how we use this information."', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: '', }); const { queryByRole } = render(reduxWrapper()); @@ -121,7 +121,7 @@ describe('ProgressiveProfilingTests', () => { }); it('should display button "Learn more about how we use this information."', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: 'http://localhost:1999/support', }); @@ -157,7 +157,7 @@ describe('ProgressiveProfilingTests', () => { }); it('should send analytic event for support link click', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: 'http://localhost:1999/support', }); render(reduxWrapper()); @@ -200,7 +200,7 @@ describe('ProgressiveProfilingTests', () => { }); describe('Embedded Form Workflow Test', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { SEARCH_CATALOG_URL: 'http://localhost/search', }); const host = 'http://example.com'; diff --git a/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx b/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx index 201c643a..d7896d94 100644 --- a/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx +++ b/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx @@ -3,21 +3,21 @@ import { } from '@openedx/frontend-base'; import { render } from '@testing-library/react'; -import { testAppId } from '../../../setupTest'; +import { appId } from '../../../constants'; import { HonorCode } from '../index'; const IntlHonorCode = injectIntl(HonorCode); const providerWrapper = children => ( - + {children} ); describe('HonorCodeTest', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { PRIVACY_POLICY: 'http://privacy-policy.com', TOS_AND_HONOR_CODE: 'http://tos-and-honot-code.com', }); diff --git a/src/register/RegistrationPage.test.jsx b/src/register/RegistrationPage.test.jsx index 9207d1ad..39667656 100644 --- a/src/register/RegistrationPage.test.jsx +++ b/src/register/RegistrationPage.test.jsx @@ -11,7 +11,8 @@ import configureStore from 'redux-mock-store'; import { AUTHN_PROGRESSIVE_PROFILING, COMPLETE_STATE, PENDING_STATE, REGISTER_PAGE, } from '../data/constants'; -import { initializeMockServices, testAppId } from '../setupTest'; +import { appId } from '../constants'; +import { initializeMockServices } from '../setupTest'; import { backupRegistrationFormBegin, clearRegistrationBackendError, @@ -51,7 +52,7 @@ jest.mock('react-router-dom', () => { jest.mock('universal-cookie'); describe('RegistrationPage', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { PRIVACY_POLICY: 'https://privacy-policy.com', TOS_AND_HONOR_CODE: 'https://tos-and-honot-code.com', USER_RETENTION_COOKIE_NAME: 'authn-returning-user', @@ -76,7 +77,7 @@ describe('RegistrationPage', () => { const reduxWrapper = children => ( - + {children} @@ -256,7 +257,7 @@ describe('RegistrationPage', () => { }); it('should submit form with marketing email opt in value', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { MARKETING_EMAILS_OPT_IN: 'true', }); @@ -278,13 +279,13 @@ describe('RegistrationPage', () => { fireEvent.click(button); expect(store.dispatch).toHaveBeenCalledWith(registerNewUser({ ...payload })); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { MARKETING_EMAILS_OPT_IN: '', }); }); it('should submit form without UsernameField when autoGeneratedUsernameEnabled is true', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_AUTO_GENERATED_USERNAME: true, }); jest.spyOn(global.Date, 'now').mockImplementation(() => 0); @@ -301,20 +302,20 @@ describe('RegistrationPage', () => { const button = container.querySelector('button.btn-brand'); fireEvent.click(button); expect(store.dispatch).toHaveBeenCalledWith(registerNewUser({ ...payload })); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_AUTO_GENERATED_USERNAME: false, }); }); it('should not display UsernameField when ENABLE_AUTO_GENERATED_USERNAME is true', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_AUTO_GENERATED_USERNAME: true, }); const { queryByLabelText } = render(routerWrapper(reduxWrapper())); expect(queryByLabelText('Username')).toBeNull(); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_AUTO_GENERATED_USERNAME: false, }); }); @@ -431,7 +432,7 @@ describe('RegistrationPage', () => { }); it('should display opt-in/opt-out checkbox', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { MARKETING_EMAILS_OPT_IN: 'true', }); @@ -439,7 +440,7 @@ describe('RegistrationPage', () => { const checkboxDivs = container.querySelectorAll('div.form-field--checkbox'); expect(checkboxDivs.length).toEqual(1); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { MARKETING_EMAILS_OPT_IN: '', }); }); @@ -468,7 +469,7 @@ describe('RegistrationPage', () => { }); render(routerWrapper(reduxWrapper())); - expect(Cookies.prototype.set).toHaveBeenCalledWith(getAppConfig(testAppId).USER_RETENTION_COOKIE_NAME, true, { domain: 'local.openedx.io', path: '/' }); + expect(Cookies.prototype.set).toHaveBeenCalledWith(getAppConfig(appId).USER_RETENTION_COOKIE_NAME, true, { domain: 'local.openedx.io', path: '/' }); }); it('should redirect to url returned in registration result after successful account creation', () => { @@ -490,7 +491,7 @@ describe('RegistrationPage', () => { }); it('should redirect to dashboard if features flags are configured but no optional fields are configured', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true, }); const dashboardUrl = 'https://test.com/testing-dashboard/'; @@ -518,7 +519,7 @@ describe('RegistrationPage', () => { it('should redirect to progressive profiling page if optional fields are configured', () => { getLocale.mockImplementation(() => ('en-us')); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true, }); @@ -679,7 +680,7 @@ describe('RegistrationPage', () => { it('should call the postMessage API when embedded variant is rendered', () => { getLocale.mockImplementation(() => ('en-us')); - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true, }); diff --git a/src/register/components/tests/ConfigurableRegistrationForm.test.jsx b/src/register/components/tests/ConfigurableRegistrationForm.test.jsx index 5c38d2c5..6eeb7c05 100644 --- a/src/register/components/tests/ConfigurableRegistrationForm.test.jsx +++ b/src/register/components/tests/ConfigurableRegistrationForm.test.jsx @@ -7,7 +7,7 @@ import { fireEvent, render } from '@testing-library/react'; import { BrowserRouter as Router } from 'react-router-dom'; import configureStore from 'redux-mock-store'; -import { testAppId } from '../../../setupTest'; +import { appId } from '../../../constants'; import { registerNewUser } from '../../data/actions'; import { FIELDS } from '../../data/constants'; import RegistrationPage from '../../RegistrationPage'; @@ -30,7 +30,7 @@ const IntlRegistrationPage = injectIntl(RegistrationPage); const mockStore = configureStore(); describe('ConfigurableRegistrationForm', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { PRIVACY_POLICY: 'https://privacy-policy.com', TOS_AND_HONOR_CODE: 'https://tos-and-honot-code.com', }); @@ -54,7 +54,7 @@ describe('ConfigurableRegistrationForm', () => { const reduxWrapper = children => ( - + {children} @@ -126,7 +126,7 @@ describe('ConfigurableRegistrationForm', () => { }; describe('Test Configurable Fields', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_DYNAMIC_REGISTRATION_FIELDS: true, }); @@ -201,7 +201,7 @@ describe('ConfigurableRegistrationForm', () => { }); it('should submit form with fields returned by backend in payload', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { ENABLE_DYNAMIC_REGISTRATION_FIELDS: true, }); getLocale.mockImplementation(() => ('en-us')); diff --git a/src/register/components/tests/RegistrationFailure.test.jsx b/src/register/components/tests/RegistrationFailure.test.jsx index e38ca183..a2c842dd 100644 --- a/src/register/components/tests/RegistrationFailure.test.jsx +++ b/src/register/components/tests/RegistrationFailure.test.jsx @@ -10,7 +10,7 @@ import configureStore from 'redux-mock-store'; import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR, TPA_AUTHENTICATION_FAILURE, TPA_SESSION_EXPIRED, } from '../../data/constants'; -import { testAppId } from '../../../setupTest'; +import { appId } from '../../../constants'; import RegistrationPage from '../../RegistrationPage'; import RegistrationFailureMessage from '../RegistrationFailure'; @@ -41,7 +41,7 @@ jest.mock('react-router-dom', () => { }); describe('RegistrationFailure', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { PRIVACY_POLICY: 'https://privacy-policy.com', TOS_AND_HONOR_CODE: 'https://tos-and-honot-code.com', USER_RETENTION_COOKIE_NAME: 'authn-returning-user', diff --git a/src/register/components/tests/ThirdPartyAuth.test.jsx b/src/register/components/tests/ThirdPartyAuth.test.jsx index 841feea4..2127e7a4 100644 --- a/src/register/components/tests/ThirdPartyAuth.test.jsx +++ b/src/register/components/tests/ThirdPartyAuth.test.jsx @@ -10,7 +10,7 @@ import configureStore from 'redux-mock-store'; import { COMPLETE_STATE, LOGIN_PAGE, PENDING_STATE, REGISTER_PAGE, } from '../../../data/constants'; -import { testAppId } from '../../../setupTest'; +import { appId } from '../../../constants'; import RegistrationPage from '../../RegistrationPage'; jest.mock('@openedx/frontend-base', () => ({ @@ -40,7 +40,7 @@ jest.mock('react-router-dom', () => { }); describe('ThirdPartyAuth', () => { - mergeAppConfig(testAppId, { + mergeAppConfig(appId, { PRIVACY_POLICY: 'https://privacy-policy.com', TOS_AND_HONOR_CODE: 'https://tos-and-honot-code.com', USER_RETENTION_COOKIE_NAME: 'authn-returning-user', diff --git a/src/reset-password/tests/ResetPasswordPage.test.jsx b/src/reset-password/tests/ResetPasswordPage.test.jsx index 59a3775f..e96125d1 100644 --- a/src/reset-password/tests/ResetPasswordPage.test.jsx +++ b/src/reset-password/tests/ResetPasswordPage.test.jsx @@ -8,7 +8,8 @@ import { act } from 'react-dom/test-utils'; import { MemoryRouter, useParams } from 'react-router-dom'; import configureStore from 'redux-mock-store'; -import { testAppId, initializeMockServices } from '../../setupTest'; +import { appId } from '../../constants'; +import { initializeMockServices } from '../../setupTest'; import { LOGIN_PAGE, RESET_PAGE } from '../../data/constants'; import { resetPassword, validateToken } from '../data/actions'; import { @@ -36,7 +37,7 @@ describe('ResetPasswordPage', () => { const reduxWrapper = children => ( - + {children} diff --git a/src/setupTest.js b/src/setupTest.js index 7f0fd54a..0f3df8d3 100755 --- a/src/setupTest.js +++ b/src/setupTest.js @@ -5,8 +5,6 @@ import { addAppConfigs, configureAnalytics, configureAuth, configureLogging, get mergeSiteConfig(siteConfig); addAppConfigs(); -export const testAppId = getSiteConfig().apps[0].appId; - export function initializeMockServices() { const loggingService = configureLogging(MockLoggingService, { config: getSiteConfig(),