2026-09-19 18:20:59 +03:00
|
|
|
import '@testing-library/jest-dom/vitest';
|
|
|
|
|
import { afterEach, vi } from 'vitest';
|
|
|
|
|
import { cleanup } from '@testing-library/react';
|
|
|
|
|
|
2026-09-19 21:53:35 +03:00
|
|
|
// Общий экземпляр i18next для всех тестов: без него useTranslation вернёт ключи.
|
|
|
|
|
import '@/i18n';
|
|
|
|
|
import { setQueryClient } from '@/lib/queryClient';
|
|
|
|
|
|
2026-09-19 18:20:59 +03:00
|
|
|
afterEach(() => {
|
|
|
|
|
cleanup();
|
|
|
|
|
// Globals stubbed with vi.stubGlobal must be dropped between tests,
|
|
|
|
|
// otherwise a stub from one test leaks into the next one.
|
|
|
|
|
vi.unstubAllGlobals();
|
|
|
|
|
vi.restoreAllMocks();
|
|
|
|
|
window.localStorage.clear();
|
2026-09-19 21:53:35 +03:00
|
|
|
setQueryClient(null);
|
2026-09-19 18:20:59 +03:00
|
|
|
});
|