// Configuration globale pour les tests Jest // Mock pour les modules WASM jest.mock('pkg/sdk_client', () => ({ __esModule: true, default: { init: jest.fn().mockResolvedValue(undefined), hash_value: jest.fn().mockReturnValue('mock_hash'), get_merkle_proof: jest.fn().mockReturnValue({ proof: 'mock_proof' }), validate_merkle_proof: jest.fn().mockReturnValue(true), generate_sp_wallet: jest.fn().mockReturnValue({ wallet: 'mock_wallet' }), lock_freezed_utxos: jest.fn().mockReturnValue(true), scan_blocks: jest.fn().mockReturnValue([]), set_new_device: jest.fn().mockReturnValue(true), lock_local_device: jest.fn().mockReturnValue(true), LOCAL_DEVICE: 'mock_device' } })); // Mock pour les variables d'environnement process.env.VITE_JWT_SECRET_KEY = 'test-secret-key'; // Mock pour les APIs Web global.fetch = jest.fn(); // Mock pour les WebSockets global.WebSocket = jest.fn().mockImplementation(() => ({ send: jest.fn(), close: jest.fn(), addEventListener: jest.fn(), removeEventListener: jest.fn(), readyState: 1 })); // Mock pour localStorage const localStorageMock = { getItem: jest.fn(), setItem: jest.fn(), removeItem: jest.fn(), clear: jest.fn(), }; global.localStorage = localStorageMock; // Mock pour sessionStorage const sessionStorageMock = { getItem: jest.fn(), setItem: jest.fn(), removeItem: jest.fn(), clear: jest.fn(), }; global.sessionStorage = sessionStorageMock; // Configuration des timeouts jest.setTimeout(10000); // Nettoyage après chaque test afterEach(() => { jest.clearAllMocks(); localStorageMock.clear(); sessionStorageMock.clear(); });