// @vitest-environment jsdom import {afterEach, describe, expect, it, vi} from 'vitest'; import {cleanup, render, screen} from '@testing-library/react'; import StatCard from './StatCard.jsx'; vi.mock('react-i18next', () => import('../test/i18n-mock.js')); afterEach(() => { cleanup(); delete document.documentElement.dataset.reduceMotion; }); describe('StatCard', () => { it('shows the final number at once when the user wants reduced motion', () => { document.documentElement.dataset.reduceMotion = 'true'; render(); expect(screen.getByText('1.234')).toBeTruthy(); }); it('counts up from 0 otherwise', () => { render(); expect(screen.getByText('0')).toBeTruthy(); }); });