Files
fotospiel-app/resources/js/setupTests.ts
Codex Agent 0535f63b40
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
tests / ui (push) Waiting to run
Align admin theme with Tamagui v2
2026-02-03 22:40:16 +01:00

39 lines
1023 B
TypeScript

import '@testing-library/jest-dom';
import { vi } from 'vitest';
vi.mock('react-i18next', async () => {
const actual = await vi.importActual<typeof import('react-i18next')>('react-i18next');
return {
...actual,
useTranslation: () => ({
t: (key: string, options?: Record<string, unknown>) => {
if (options && typeof options.defaultValue === 'string') {
return options.defaultValue;
}
return key;
},
i18n: {
language: 'de',
changeLanguage: vi.fn(),
},
}),
Trans: ({ children }: { children: React.ReactNode }) => children,
};
});
if (typeof window !== 'undefined' && !window.matchMedia) {
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
}),
});
}