From bb29f9624ea6bc159914014afdfff34d3b7c94cf Mon Sep 17 00:00:00 2001 From: sundasnoreen12 Date: Mon, 13 May 2024 17:21:53 +0500 Subject: [PATCH] fix: fixed test cases --- .../NotificationPreferenceColumn.jsx | 2 +- .../NotificationPreferences.test.jsx | 16 +++++++++++++--- .../NotificationTypes.jsx | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/notification-preferences/NotificationPreferenceColumn.jsx b/src/notification-preferences/NotificationPreferenceColumn.jsx index 2fc0374..ff297c3 100644 --- a/src/notification-preferences/NotificationPreferenceColumn.jsx +++ b/src/notification-preferences/NotificationPreferenceColumn.jsx @@ -52,7 +52,7 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => { }, [appId]); const renderPreference = (preference) => ( - (preference.coreNotificationTypes.length > 0 || preference.id !== 'core') && ( + (preference?.coreNotificationTypes?.length > 0 || preference.id !== 'core') && (
({ preferences: [ - { id: 'core', appId: 'discussion', web: true }, - { id: 'newComment', appId: 'discussion', web: toggleVal }, - { id: 'newAssignment', appId: 'coursework', web: toggleVal }, + { + id: 'core', appId: 'discussion', web: true, coreNotificationTypes: ['new_comment'], + }, + { + id: 'newComment', appId: 'discussion', web: toggleVal, coreNotificationTypes: [], + }, + { + id: 'newAssignment', appId: 'coursework', web: toggleVal, coreNotificationTypes: [], + }, ], }); diff --git a/src/notification-preferences/NotificationTypes.jsx b/src/notification-preferences/NotificationTypes.jsx index 64dd7d9..2fb3795 100644 --- a/src/notification-preferences/NotificationTypes.jsx +++ b/src/notification-preferences/NotificationTypes.jsx @@ -21,7 +21,7 @@ const NotificationTypes = ({ appId }) => {
{!mobileView && {intl.formatMessage(messages.typeLabel)}} {preferences.map(preference => ( - (preference.coreNotificationTypes.length > 0 || preference.id !== 'core') && ( + (preference?.coreNotificationTypes?.length > 0 || preference.id !== 'core') && ( <>