diff --git a/src/Header.test.jsx b/src/Header.test.jsx
index 51fef20..7636460 100644
--- a/src/Header.test.jsx
+++ b/src/Header.test.jsx
@@ -2,24 +2,38 @@
import React from 'react';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import TestRenderer from 'react-test-renderer';
-import { AppContext } from '@edx/frontend-platform/react';
+import { AppContext, AppProvider } from '@edx/frontend-platform/react';
import { Context as ResponsiveContext } from 'react-responsive';
+import { initializeMockApp } from '@edx/frontend-platform';
+import store from './store';
import Header from './index';
const HeaderComponent = ({ width, contextValue }) => (
-
-
-
+
+
+
+
+
);
describe('', () => {
+ beforeEach(async () => {
+ initializeMockApp({
+ authenticatedUser: {
+ userId: '123abc',
+ username: 'testuser',
+ administrator: false,
+ roles: [],
+ },
+ });
+ });
it('renders correctly for anonymous desktop', () => {
const contextValue = {
authenticatedUser: null,
diff --git a/src/Notifications/NotificationRowItem.jsx b/src/Notifications/NotificationRowItem.jsx
index b8c97d3..b6ebc7b 100644
--- a/src/Notifications/NotificationRowItem.jsx
+++ b/src/Notifications/NotificationRowItem.jsx
@@ -16,7 +16,7 @@ const NotificationRowItem = ({ notification }) => {
timeago.register('time-locale', timeLocale);
const { authenticatedUser } = useContext(AppContext);
- const handleIconByType = (type) => {
+ const getIconByType = (type) => {
switch (type) {
case 'post': return PostOutline;
case 'help': return HelpOutline;
@@ -34,7 +34,7 @@ const NotificationRowItem = ({ notification }) => {
};
const getContentMessageByType = useCallback(() => {
- const typeMap = {
+ const contentMessage = {
post: messages.notificationPostedContent,
help: messages.notificationHelpedContent,
respond: authenticatedUser.username !== notification.author
@@ -49,14 +49,14 @@ const NotificationRowItem = ({ notification }) => {
commentLiked: messages.notificationCommentLikedLabel,
edited: messages.notificationEditedLabel,
};
- return typeMap[notification.type] ? intl.formatMessage(typeMap[notification.type]) : null;
+ return contentMessage[notification.type] ? intl.formatMessage(contentMessage[notification.type]) : null;
}, [authenticatedUser, notification, intl]);
return (
diff --git a/src/Notifications/NotificationTabs.jsx b/src/Notifications/NotificationTabs.jsx
index b8f9d6d..6898d3a 100644
--- a/src/Notifications/NotificationTabs.jsx
+++ b/src/Notifications/NotificationTabs.jsx
@@ -16,7 +16,7 @@ const NotificationTabs = () => {
const dispatch = useDispatch();
useEffect(() => {
- dispatch(fetchNotificationList({ notificationType: activeTab || 'reminders', notificationCount: loadMoreCount }));
+ dispatch(fetchNotificationList({ notificationType: activeTab, notificationCount: loadMoreCount }));
}, [dispatch, activeTab, loadMoreCount]);
const handleActiveTab = useCallback((tab) => {
@@ -42,7 +42,7 @@ const NotificationTabs = () => {
activeTab && (
diff --git a/src/__snapshots__/Header.test.jsx.snap b/src/__snapshots__/Header.test.jsx.snap
index f83161b..4c36abd 100644
--- a/src/__snapshots__/Header.test.jsx.snap
+++ b/src/__snapshots__/Header.test.jsx.snap
@@ -237,6 +237,43 @@ exports[` renders correctly for authenticated desktop 1`] = `
aria-label="Secondary"
className="nav secondary-menu-container align-items-center ml-auto"
>
+