diff --git a/src/App.jsx b/src/App.jsx
index 56869fa..3a062ea 100755
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -48,7 +48,7 @@ export const App = () => {
} if (getConfig().OPTIMIZELY_PROJECT_ID) {
return (
);
}
diff --git a/src/App.test.jsx b/src/App.test.jsx
index f2090f5..0e8a01a 100644
--- a/src/App.test.jsx
+++ b/src/App.test.jsx
@@ -4,6 +4,7 @@ import { shallow } from '@edx/react-unit-test-utils';
import Footer from '@edx/frontend-component-footer';
import { useIntl } from '@edx/frontend-platform/i18n';
+import { getConfig } from '@edx/frontend-platform';
import { RequestKeys } from 'data/constants/requests';
import { reduxHooks } from 'hooks';
@@ -40,7 +41,7 @@ jest.mock('data/store', () => 'data/store');
const logo = 'fakeLogo.png';
jest.mock('@edx/frontend-platform', () => ({
- getConfig: jest.fn(() => ({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo })),
+ getConfig: jest.fn(() => ({})),
}));
const loadData = jest.fn();
@@ -77,6 +78,43 @@ describe('App router component', () => {
describe('no network failure', () => {
beforeAll(() => {
reduxHooks.useRequestIsFailed.mockReturnValue(false);
+ getConfig.mockReturnValue({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo });
+ el = shallow();
+ });
+ runBasicTests();
+ it('loads dashboard', () => {
+ const main = el.instance.findByType('main')[0];
+ expect(main.children.length).toEqual(1);
+ const expProvider = main.children[0];
+ expect(expProvider.type).toEqual('ExperimentProvider');
+ expect(expProvider.children.length).toEqual(1);
+ expect(
+ expProvider.matches(shallow()),
+ ).toEqual(true);
+ });
+ });
+ describe('no network failure with optimizely url', () => {
+ beforeAll(() => {
+ reduxHooks.useRequestIsFailed.mockReturnValue(false);
+ getConfig.mockReturnValue({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo, OPTIMIZELY_URL: 'fake.url' });
+ el = shallow();
+ });
+ runBasicTests();
+ it('loads dashboard', () => {
+ const main = el.instance.findByType('main')[0];
+ expect(main.children.length).toEqual(1);
+ const expProvider = main.children[0];
+ expect(expProvider.type).toEqual('ExperimentProvider');
+ expect(expProvider.children.length).toEqual(1);
+ expect(
+ expProvider.matches(shallow()),
+ ).toEqual(true);
+ });
+ });
+ describe('no network failure with optimizely project id', () => {
+ beforeAll(() => {
+ reduxHooks.useRequestIsFailed.mockReturnValue(false);
+ getConfig.mockReturnValue({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo, OPTIMIZELY_PROJECT_ID: 'fakeId' });
el = shallow();
});
runBasicTests();
@@ -94,6 +132,7 @@ describe('App router component', () => {
describe('initialize failure', () => {
beforeAll(() => {
reduxHooks.useRequestIsFailed.mockImplementation((key) => key === RequestKeys.initialize);
+ getConfig.mockReturnValue({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo });
el = shallow();
});
runBasicTests();
@@ -111,6 +150,7 @@ describe('App router component', () => {
describe('refresh failure', () => {
beforeAll(() => {
reduxHooks.useRequestIsFailed.mockImplementation((key) => key === RequestKeys.refreshList);
+ getConfig.mockReturnValue({ LOGO_POWERED_BY_OPEN_EDX_URL_SVG: logo });
el = shallow();
});
runBasicTests();
diff --git a/src/__snapshots__/App.test.jsx.snap b/src/__snapshots__/App.test.jsx.snap
index 81c6b4b..9a15f51 100644
--- a/src/__snapshots__/App.test.jsx.snap
+++ b/src/__snapshots__/App.test.jsx.snap
@@ -66,6 +66,74 @@ exports[`App router component component no network failure snapshot 1`] = `
`;
+exports[`App router component component no network failure with optimizely project id snapshot 1`] = `
+
+
+
+ Learner Home
+
+
+
+
+
+
+`;
+
+exports[`App router component component no network failure with optimizely url snapshot 1`] = `
+
+
+
+ Learner Home
+
+
+
+
+
+
+`;
+
exports[`App router component component refresh failure snapshot 1`] = `