Relative Content

Tag Archive for reactjstypescriptreact-hooksts-jest

Test keeps failing even though component unmounted in the app

import { render, screen } from ‘@testing-library/react’; import ‘@testing-library/jest-dom/extend-expect’; import { act } from ‘react’ import Notifications, { defaultNotificationTime, defaultOpacity, queuedNotificationTime, fadeInTime } from ‘../Components/Notifications’; import { NotificationContext } from ‘../Context/NotificationContext’; const renderNotification = (notifications: string[], setNotifications: jest.Mock) => { return render( <NotificationContext.Provider value={{ notifications, setNotifications }}> <Notifications /> </NotificationContext.Provider> ); }; beforeEach(() => jest.useFakeTimers()); […]