Skip to content

Commit

Permalink
fix: fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Nov 19, 2024
1 parent 27c686f commit 70a00f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports[`ConfirmationModal should match empty password confirmation modal snapsh
/>
<div
aria-label="Are you sure?"
className="pgn__modal pgn__modal-md pgn__modal-default pgn__modal-visible-overflow pgn__alert-modal"
className="pgn__modal pgn__modal-md pgn__modal-default pgn__alert-modal"
role="dialog"
>
<div
Expand Down Expand Up @@ -242,7 +242,7 @@ exports[`ConfirmationModal should match open confirmation modal snapshot 1`] = `
/>
<div
aria-label="Are you sure?"
className="pgn__modal pgn__modal-md pgn__modal-default pgn__modal-visible-overflow pgn__alert-modal"
className="pgn__modal pgn__modal-md pgn__modal-default pgn__alert-modal"
role="dialog"
>
<div
Expand Down
10 changes: 10 additions & 0 deletions src/account-settings/test/AccountSettingsPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<IntlAccountSettingsPage {...props} />));

Expand Down
2 changes: 1 addition & 1 deletion src/account-settings/test/mockData.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const mockData = {
preferences: {
status: 'idle',
updatePreferenceStatus: 'idle',
selectedCourse: null,
selectedCourse: 'account',
preferences: [],
apps: [],
nonEditable: {},
Expand Down
6 changes: 0 additions & 6 deletions src/notification-preferences/NotificationPreferences.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
15 changes: 8 additions & 7 deletions src/notification-preferences/data/reducers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ describe('notification-preferences reducer', () => {
hasMore: false,
totalPages: 1,
},
courseList: [
{ id: selectedCourseId, name: 'Selected Course' },
],
courseList: [],
};
const result = reducer(
state,
{ type: Actions.FETCHED_COURSE_LIST, payload: data },
);
expect(result.courses).toEqual({
status: SUCCESS_STATUS,
courses: data.courseList,
courses: [{ id: 'account', name: 'Account' }],
pagination: data.pagination,
});
});
Expand All @@ -61,7 +59,10 @@ describe('notification-preferences reducer', () => {
);
expect(result.courses).toEqual({
status,
courses: [],
courses: [{
id: 'account',
name: 'Account',
}],
pagination: {},
});
});
Expand All @@ -82,7 +83,7 @@ describe('notification-preferences reducer', () => {
expect(result.preferences).toEqual({
status: SUCCESS_STATUS,
updatePreferenceStatus: SUCCESS_STATUS,
selectedCourse: null,
selectedCourse: 'account',
...preferenceData,
});
});
Expand All @@ -97,7 +98,7 @@ describe('notification-preferences reducer', () => {
);
expect(result.preferences).toEqual({
status,
selectedCourse: null,
selectedCourse: 'account',
preferences: [],
apps: [],
nonEditable: {},
Expand Down

0 comments on commit 70a00f1

Please sign in to comment.