Skip to content

Commit

Permalink
test: fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Oct 17, 2023
1 parent bc8197a commit ced2927
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/notification-preferences/data/reducers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FAILURE_STATUS,
LOADING_STATUS,
SUCCESS_STATUS,
IDLE_STATUS,
} from '../../constants';

describe('notification-preferences reducer', () => {
Expand Down Expand Up @@ -80,15 +81,16 @@ describe('notification-preferences reducer', () => {
);
expect(result.preferences).toEqual({
status: SUCCESS_STATUS,
updatePreferenceStatus: SUCCESS_STATUS,
selectedCourse: null,
...preferenceData,
});
});

test.each([
{ action: Actions.FETCHING_PREFERENCES, status: LOADING_STATUS },
{ action: Actions.FAILED_PREFERENCES, status: FAILURE_STATUS },
])('preferences are empty when api call is %s', ({ action, status }) => {
{ action: Actions.FETCHING_PREFERENCES, status: LOADING_STATUS, updatePreferenceStatus: IDLE_STATUS },
{ action: Actions.FAILED_PREFERENCES, status: FAILURE_STATUS, updatePreferenceStatus: FAILURE_STATUS },
])('preferences are empty when api call is %s', ({ action, status, updatePreferenceStatus }) => {
const result = reducer(
state,
{ type: action },
Expand All @@ -99,6 +101,7 @@ describe('notification-preferences reducer', () => {
preferences: [],
apps: [],
nonEditable: {},
updatePreferenceStatus,
});
});

Expand Down

0 comments on commit ced2927

Please sign in to comment.