1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(test) fix broken test

This commit is contained in:
Karen 2023-02-03 15:36:41 +01:00 committed by Sylvain
parent 856a6fa321
commit 84b28ffddf
6 changed files with 19 additions and 7 deletions

View File

@ -18,7 +18,7 @@ declare const Application: IApplication;
interface EventsSettingsProps {
onError: (message: string) => void,
onSuccess: (message: string) => void
uiRouter: UIRouter
uiRouter?: UIRouter
}
/**
@ -60,7 +60,7 @@ export const EventsSettings: React.FC<EventsSettingsProps> = ({ onError, onSucce
<FabButton onClick={handleSubmit(onSubmit)} className='save-btn is-main'>{t('app.admin.events_settings.save')}</FabButton>
</header>
<form className="events-settings-content">
<UnsavedFormAlert uiRouter={uiRouter} formState={formState} />
{uiRouter && <UnsavedFormAlert uiRouter={uiRouter} formState={formState} />}
<div className="settings-section">
<EditorialBlockForm register={register}
control={control}

View File

@ -19,7 +19,7 @@ interface MachinesSettingsProps {
onError: (message: string) => void,
onSuccess: (message: string) => void,
beforeSubmit?: (data: Record<SettingName, SettingValue>) => void,
uiRouter: UIRouter
uiRouter?: UIRouter
}
/**
@ -62,7 +62,7 @@ export const MachinesSettings: React.FC<MachinesSettingsProps> = ({ onError, onS
<FabButton onClick={handleSubmit(onSubmit)} className='save-btn is-main'>{t('app.admin.machines_settings.save')}</FabButton>
</header>
<form className="machines-settings-content">
<UnsavedFormAlert uiRouter={uiRouter} formState={formState} />
{uiRouter && <UnsavedFormAlert uiRouter={uiRouter} formState={formState} />}
<div className="settings-section">
<EditorialBlockForm register={register}
control={control}

View File

@ -68,7 +68,7 @@ const NotificationsList: React.FC<NotificationsListProps> = ({ onError }) => {
};
return (
<div className="notifications-list">
<div className="notifications-list" data-testid="notifications-list">
<header className="notifications-header">
<h2 className="title">{t('app.logged.notifications_list.notifications')}</h2>
{totals.unread > 0 &&

View File

@ -21,7 +21,7 @@ declare const Application: IApplication;
interface TrainingsSettingsProps {
onError: (message: string) => void,
onSuccess: (message: string) => void,
uiRouter: UIRouter
uiRouter?: UIRouter
}
/**
@ -71,7 +71,7 @@ export const TrainingsSettings: React.FC<TrainingsSettingsProps> = ({ onError, o
<FabButton onClick={() => handleSubmit(onSubmit)()} className='save-btn is-main'>{t('app.admin.trainings_settings.save')}</FabButton>
</header>
<form className="trainings-settings-content">
<UnsavedFormAlert uiRouter={uiRouter} formState={formState} />
{uiRouter && <UnsavedFormAlert uiRouter={uiRouter} formState={formState} />}
<div className="settings-section">
<EditorialBlockForm register={register}
control={control}

View File

@ -0,0 +1,12 @@
import { render, screen, waitFor } from '@testing-library/react';
import { NotificationsList } from '../../../../app/frontend/src/javascript/components/notifications/notifications-list';
// Notifications list in Notification Center
describe('Notifications list', () => {
test('should render the correct list', async () => {
const onError = jest.fn();
render(<NotificationsList onError={onError} />);
await waitFor(() => screen.getByTestId('notifications-list'));
});
});