Files
glchat/web/tests/setup.ts
T

18 lines
602 B
TypeScript
Raw Normal View History

import '@testing-library/jest-dom/vitest';
import { afterEach, vi } from 'vitest';
import { cleanup } from '@testing-library/react';
// Общий экземпляр i18next для всех тестов: без него useTranslation вернёт ключи.
import '@/i18n';
import { setQueryClient } from '@/lib/queryClient';
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();
setQueryClient(null);
});