diff --git a/src/Notifications/data/api.js b/src/Notifications/data/api.js index 2aa2c05dc..020ef8046 100644 --- a/src/Notifications/data/api.js +++ b/src/Notifications/data/api.js @@ -4,7 +4,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; export const getNotificationsCountApiUrl = () => `${getConfig().LMS_BASE_URL}/api/notifications/count/`; export const getNotificationsApiUrl = () => `${getConfig().LMS_BASE_URL}/api/notifications/`; export const markNotificationsSeenApiUrl = (appName) => `${getConfig().LMS_BASE_URL}/api/notifications/mark-notifications-unseen/${appName}/`; -export const markAllNotificationsAsReadpiUrl = () => `${getConfig().LMS_BASE_URL}/api/notifications/read/`; +export const markNotificationAsReadApiUrl = () => `${getConfig().LMS_BASE_URL}/api/notifications/read/`; export async function getNotifications(appName, page, pageSize) { const params = snakeCaseObject({ page, pageSize }); @@ -31,14 +31,14 @@ export async function markNotificationSeen(appName) { export async function markAllNotificationRead(appName) { const params = snakeCaseObject({ appName }); - const { data } = await getAuthenticatedHttpClient().put(markAllNotificationsAsReadpiUrl(), { params }); + const { data } = await getAuthenticatedHttpClient().put(markNotificationAsReadApiUrl(), { params }); return data; } export async function markNotificationRead(notificationId) { const params = snakeCaseObject({ notificationId }); - const { data } = await getAuthenticatedHttpClient().put(markAllNotificationsAsReadpiUrl(), { params }); + const { data } = await getAuthenticatedHttpClient().put(markNotificationAsReadApiUrl(), { params }); return { data, id: notificationId }; } diff --git a/src/Notifications/data/api.test.js b/src/Notifications/data/api.test.js index 488aeabb4..9c0d82a48 100644 --- a/src/Notifications/data/api.test.js +++ b/src/Notifications/data/api.test.js @@ -5,7 +5,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; import { initializeMockApp } from '@edx/frontend-platform/testing'; import { - getNotificationsApiUrl, getNotificationsCountApiUrl, markAllNotificationsAsReadpiUrl, markNotificationsSeenApiUrl, + getNotificationsApiUrl, getNotificationsCountApiUrl, markNotificationAsReadApiUrl, markNotificationsSeenApiUrl, getNotificationCounts, getNotifications, markNotificationSeen, markAllNotificationRead, markNotificationRead, } from './api'; @@ -14,7 +14,7 @@ import './__factories__'; const notificationCountsApiUrl = getNotificationsCountApiUrl(); const notificationsApiUrl = getNotificationsApiUrl(); const markedAllNotificationsAsSeenApiUrl = markNotificationsSeenApiUrl('discussions'); -const markedAllNotificationsAsReadApiUrl = markAllNotificationsAsReadpiUrl(); +const markedAllNotificationsAsReadApiUrl = markNotificationAsReadApiUrl(); let axiosMock = null; diff --git a/src/Notifications/data/redux.test.js b/src/Notifications/data/redux.test.js index bada66611..f17e6bf50 100644 --- a/src/Notifications/data/redux.test.js +++ b/src/Notifications/data/redux.test.js @@ -7,7 +7,7 @@ import { initializeMockApp } from '@edx/frontend-platform/testing'; import { initializeStore } from '../../store'; import executeThunk from '../../test-utils'; import { - getNotificationsApiUrl, getNotificationsCountApiUrl, markAllNotificationsAsReadpiUrl, markNotificationsSeenApiUrl, + getNotificationsApiUrl, getNotificationsCountApiUrl, markNotificationAsReadApiUrl, markNotificationsSeenApiUrl, } from './api'; import { fetchAppsNotificationCount, fetchNotificationList, markNotificationsAsRead, markAllNotificationsAsRead, @@ -18,7 +18,7 @@ import './__factories__'; const notificationCountsApiUrl = getNotificationsCountApiUrl(); const notificationsApiUrl = getNotificationsApiUrl(); -const markedAllNotificationsAsReadApiUrl = markAllNotificationsAsReadpiUrl(); +const markedAllNotificationsAsReadApiUrl = markNotificationAsReadApiUrl(); const markedAllNotificationsAsSeenApiUrl = markNotificationsSeenApiUrl('discussions'); let axiosMock; @@ -139,18 +139,6 @@ describe('Notification Redux', () => { expect(firstNotification.lastRead).not.toBeNull(); }); - it.each([ - { statusCode: 404, status: 'failed' }, - { statusCode: 403, status: 'denied' }, - ])('%s to mark all notifications as read for selected app in the redux.', async ({ statusCode, status }) => { - axiosMock.onPut(markedAllNotificationsAsReadApiUrl).reply(statusCode); - await executeThunk(markAllNotificationsAsRead('discussions'), store.dispatch, store.getState); - - const { notifications: { notificationStatus } } = store.getState(); - - expect(notificationStatus).toEqual(status); - }); - it('Successfully marked notification as read in the redux.', async () => { axiosMock.onPut(markedAllNotificationsAsReadApiUrl).reply(200); await executeThunk(markNotificationsAsRead(1), store.dispatch, store.getState);