import '@testing-library/jest-dom/vitest' import { cleanup } from '@testing-library/react' import { afterEach, vi } from 'vitest' afterEach (() => { cleanup () localStorage.clear () vi.restoreAllMocks () }) Element.prototype.scrollIntoView = function () { ; } window.scroll = function () { ; } window.requestAnimationFrame = callback => { callback (0) return 0 } Object.defineProperty (window, 'matchMedia', { configurable: true, value: vi.fn ().mockImplementation (() => ({ addEventListener: vi.fn (), removeEventListener: vi.fn (), matches: false })) })