@arbius/aa-wallet
Version:
A secure and flexible Account Abstraction wallet implementation for Arbitrum One chain applications.
31 lines (30 loc) • 718 B
JavaScript
;
// Mock window.ethereum
if (typeof window !== 'undefined') {
Object.defineProperty(window, 'ethereum', {
value: {
isMetaMask: true,
request: jest.fn(),
on: jest.fn(),
removeListener: jest.fn(),
},
writable: true,
});
}
// Mock BroadcastChannel API
class MockBroadcastChannel {
constructor(name) {
this.onmessage = null;
this.postMessage = jest.fn();
this.close = jest.fn();
this.name = name;
}
}
if (typeof window !== 'undefined') {
// @ts-ignore
window.BroadcastChannel = MockBroadcastChannel;
}
// Reset mocks after each test
afterEach(() => {
jest.clearAllMocks();
});