Skip to content

Commit

Permalink
test: added update account preference test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Nov 21, 2024
1 parent 5381719 commit 5a5de29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/account-settings/test/mockData.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const mockData = {
profileDataManager: null,
},
notificationPreferences: {
showPreferences: false,
showPreferences: true,
courses: {
status: 'success',
courses: [],
Expand Down
13 changes: 13 additions & 0 deletions src/notification-preferences/NotificationPreferences.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const setupStore = (override = {}) => {
storeState.courses = {
status: SUCCESS_STATUS,
courses: [
{ id: '', name: 'Account' },
{ id: 'selected-course-id', name: 'Selected Course' },
],
};
Expand Down Expand Up @@ -145,4 +146,16 @@ describe('Notification Preferences', () => {
await fireEvent.click(element);
expect(mockDispatch).toHaveBeenCalled();
});

it('update account preference on click', async () => {
store = setupStore({
...defaultPreferences,
status: SUCCESS_STATUS,
selectedCourse: '',
});
await render(notificationPreferences(store));
const element = screen.getByTestId('core-web');
await fireEvent.click(element);
expect(mockDispatch).toHaveBeenCalled();
});
});

0 comments on commit 5a5de29

Please sign in to comment.