import '@testing-library/jest-dom'; // React needs this flag to accept act(...) outside of a render call. (global as any).IS_REACT_ACT_ENVIRONMENT = true; // The SDK is injected by useMasterpassScript at runtime. Tests never exercise // the real script, but service constructors call these setters eagerly. beforeEach(() => { (window as any).Masterpass = { setToken: jest.fn(), setMerchantId: jest.fn(), paymentService: { payment: jest.fn(), directPayment: jest.fn() }, verifyService: { verifyOtp: jest.fn(), resendOtp: jest.fn() } }; (window as any).Utils = { decodeJwt: jest.fn(() => ({ MerchantId: 'merchant-1', AccountKey: 'account-1', AuthenticationMethod: '3DS', Secure3dType: '3D', UserId: 'user-1' })) }; window.sessionStorage.clear(); }); afterEach(() => { jest.clearAllMocks(); });