-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
🤓 Question
(I did search around stackoverflow and spectrum)
How to properly test useTransition
using v9 api? I've tried using https://github.com/react-spring/mock-raf but tests will hang with it. Also tried mocking raf to a regular:
const FPS = 16;
global.requestAnimationFrame = (callback) => {
setTimeout(callback, FPS);
};
Testing items being added seems to work as expected, but I can't get to properly test item removal, for example:
it('should remove a notification on click', async () => {
const { queryByTestId } = renderComponent();
fireEvent.click(queryByTestId('button-selector');
expect(queryByTestId('notification-selector')).toBeTruthy();
jest.advanceTimersByTime(NOTIFICATION_TIMER);
expect(queryByTestId('notification-selector')).toBeNull();
});
Metadata
Metadata
Assignees
Labels
No labels