diff --git a/src/components/Cursor/Cursor.test.tsx b/src/components/Cursor/Cursor.test.tsx index 6d22ad7e..f937dc68 100644 --- a/src/components/Cursor/Cursor.test.tsx +++ b/src/components/Cursor/Cursor.test.tsx @@ -1,4 +1,4 @@ -import { screen, render } from '@testing-library/react'; +import { screen, render, fireEvent, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import Cursor from './Cursor'; @@ -20,4 +20,25 @@ describe('src/components/Cursor/Cursor.test.tsx', () => { const cursorElement = screen.getByTestId('cursor'); expect(cursorElement).toBeInTheDocument(); }); + + it('should render the Cursor component with mouse movement', async () => { + const cursorElement = screen.getByTestId('cursor'); + const initialPosition = { + x: cursorElement.style.left, + y: cursorElement.style.top, + }; + + fireEvent.mouseMove(document, { + clientX: 100, + clinetY: 200, + }); + + await waitFor(() => { + expect(cursorElement.style.left).not.toBe(initialPosition.x); + }); + + await waitFor(() => { + expect(cursorElement.style.top).not.toBe(initialPosition.y); + }); + }); });