forked from passportxyz/passport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.ts
33 lines (29 loc) · 841 Bytes
/
jest.setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import "@testing-library/jest-dom";
import { TextDecoder, TextEncoder } from "util";
global.TextDecoder = TextDecoder as any;
global.TextEncoder = TextEncoder as any;
const mockWallet = {
address: "0xfF7edbD01e9d044486781ff52c42EA7a01612644",
chain: "0xa",
provider: jest.fn(),
};
jest.mock("@web3-onboard/react", () => ({
init: () => ({
connectWallet: () => Promise.resolve([mockWallet]),
disconnectWallet: () => Promise.resolve(),
state: {
select: () => ({
subscribe: () => {},
}),
},
}),
useConnectWallet: () => [{ wallet: mockWallet }, () => Promise.resolve([mockWallet]), jest.fn()],
}));
jest.mock("@web3-onboard/injected-wallets", () => ({
__esModule: true,
default: () => {},
}));
jest.mock("@web3-onboard/walletconnect", () => ({
__esModule: true,
default: () => {},
}));