diff --git a/src/account-settings/test/AccountSettingsPage.test.jsx b/src/account-settings/test/AccountSettingsPage.test.jsx index 5acd4c563..385a27d17 100644 --- a/src/account-settings/test/AccountSettingsPage.test.jsx +++ b/src/account-settings/test/AccountSettingsPage.test.jsx @@ -71,6 +71,16 @@ describe('AccountSettingsPage', () => { afterEach(() => jest.clearAllMocks()); + beforeAll(() => { + global.lightningjs = { + require: jest.fn().mockImplementation((module, url) => ({ moduleName: module, url })), + }; + }); + + afterAll(() => { + delete global.lightningjs; + }); + it('renders AccountSettingsPage correctly with editing enabled', async () => { const { getByText, rerender, getByLabelText } = render(reduxWrapper()); diff --git a/src/account-settings/test/mockData.js b/src/account-settings/test/mockData.js index 6c102fe08..ac35c0991 100644 --- a/src/account-settings/test/mockData.js +++ b/src/account-settings/test/mockData.js @@ -98,7 +98,7 @@ const mockData = { preferences: { status: 'idle', updatePreferenceStatus: 'idle', - selectedCourse: null, + selectedCourse: 'account', preferences: [], apps: [], nonEditable: {}, diff --git a/src/notification-preferences/NotificationPreferences.test.jsx b/src/notification-preferences/NotificationPreferences.test.jsx index f70591e9c..067194e5e 100644 --- a/src/notification-preferences/NotificationPreferences.test.jsx +++ b/src/notification-preferences/NotificationPreferences.test.jsx @@ -9,7 +9,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { defaultState } from './data/reducers'; import NotificationPreferences from './NotificationPreferences'; -import { FAILURE_STATUS, LOADING_STATUS, SUCCESS_STATUS } from '../constants'; +import { LOADING_STATUS, SUCCESS_STATUS } from '../constants'; const courseId = 'selected-course-id'; @@ -145,10 +145,4 @@ describe('Notification Preferences', () => { await fireEvent.click(element); expect(mockDispatch).toHaveBeenCalled(); }); - - it('show not found page if invalid course id is entered in url', async () => { - store = setupStore({ status: FAILURE_STATUS, selectedCourse: 'invalid-course-id' }); - await render(notificationPreferences(store)); - expect(screen.queryByTestId('not-found-page')).toBeInTheDocument(); - }); }); diff --git a/src/notification-preferences/data/reducers.test.js b/src/notification-preferences/data/reducers.test.js index 919bbfb2d..7340d3835 100644 --- a/src/notification-preferences/data/reducers.test.js +++ b/src/notification-preferences/data/reducers.test.js @@ -36,9 +36,7 @@ describe('notification-preferences reducer', () => { hasMore: false, totalPages: 1, }, - courseList: [ - { id: selectedCourseId, name: 'Selected Course' }, - ], + courseList: [], }; const result = reducer( state, @@ -46,7 +44,7 @@ describe('notification-preferences reducer', () => { ); expect(result.courses).toEqual({ status: SUCCESS_STATUS, - courses: data.courseList, + courses: [{ id: 'account', name: 'Account' }], pagination: data.pagination, }); }); @@ -61,7 +59,10 @@ describe('notification-preferences reducer', () => { ); expect(result.courses).toEqual({ status, - courses: [], + courses: [{ + id: 'account', + name: 'Account', + }], pagination: {}, }); }); @@ -82,7 +83,7 @@ describe('notification-preferences reducer', () => { expect(result.preferences).toEqual({ status: SUCCESS_STATUS, updatePreferenceStatus: SUCCESS_STATUS, - selectedCourse: null, + selectedCourse: 'account', ...preferenceData, }); }); @@ -97,7 +98,7 @@ describe('notification-preferences reducer', () => { ); expect(result.preferences).toEqual({ status, - selectedCourse: null, + selectedCourse: 'account', preferences: [], apps: [], nonEditable: {},