test: added update account preference test case

This commit is contained in:
sundasnoreen12
2024-11-22 01:41:16 +05:00
parent 5381719477
commit 5a5de29dea
2 changed files with 14 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ const mockData = {
profileDataManager: null,
},
notificationPreferences: {
showPreferences: false,
showPreferences: true,
courses: {
status: 'success',
courses: [],

View File

@@ -77,6 +77,7 @@ const setupStore = (override = {}) => {
storeState.courses = {
status: SUCCESS_STATUS,
courses: [
{ id: '', name: 'Account' },
{ id: 'selected-course-id', name: 'Selected Course' },
],
};
@@ -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();
});
});