Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(() => {
mocked(useSelector).mockClear();
mocked(useSelector).mockReturnValue([
{
id: 1,
domain: NOTIFICATION_DOMAINS.PAGE,
kind: NOTIFICATION_KINDS_PAGE.error,
text: 'Something went wrong',
},
]);
rendered = renderComponent(
);
});
it('should render the notification component', async () => {
beforeEach(() => {
mocked(useSelector).mockClear();
mocked(useSelector).mockReturnValue([
{
id: 1,
domain: NOTIFICATION_DOMAINS.PAGE,
kind: NOTIFICATION_KINDS_PAGE.error,
text: 'Something went wrong',
},
]);
rendered = renderComponent(
);
});
it('should render the GenericNotification notification component', async () => {
notification
);
if (CustomNotificationComponent) {
return (
{
dispatch(removeNotification(notification.id));
}}
/>
);
}
switch (notification.kind) {
case NOTIFICATION_KINDS_PAGE.error:
case NOTIFICATION_KINDS_PAGE.warning:
case NOTIFICATION_KINDS_PAGE.info:
case NOTIFICATION_KINDS_PAGE.success: {
const { values, ...genericNotification } = notification;
return (
{
dispatch(removeNotification(notification.id));
}}
/>
);