Files
work-club-manager/frontend/src/test/setup.ts

26 lines
560 B
TypeScript
Raw Normal View History

import '@testing-library/jest-dom';
import { vi } from 'vitest';
const localStorageMock = {
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn(),
clear: vi.fn(),
};
// Ensure localStorage is available on both global and globalThis
global.localStorage = localStorageMock as any;
globalThis.localStorage = localStorageMock as any;
// Ensure document is available if jsdom hasn't set it up yet
if (typeof document === 'undefined') {
Object.defineProperty(globalThis, 'document', {
value: {
body: {},
},
writable: true,
});
}