-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathjest.setup.js
More file actions
62 lines (58 loc) · 1.18 KB
/
jest.setup.js
File metadata and controls
62 lines (58 loc) · 1.18 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import '@testing-library/jest-dom'
// Mock Next.js router
jest.mock('next/router', () => ({
useRouter() {
return {
route: '/',
pathname: '/',
query: '',
asPath: '',
push: jest.fn(),
pop: jest.fn(),
reload: jest.fn(),
back: jest.fn(),
prefetch: jest.fn(),
beforePopState: jest.fn(),
events: {
on: jest.fn(),
off: jest.fn(),
emit: jest.fn(),
},
isFallback: false,
}
},
}))
// Mock window.freighter for wallet testing
Object.defineProperty(window, 'freighter', {
writable: true,
value: {
getAddress: jest.fn(),
signTransaction: jest.fn(),
},
})
// Mock Stellar SDK if needed
jest.mock('@stellar/stellar-sdk', () => ({
Contract: jest.fn(),
TransactionBuilder: jest.fn(),
BASE_FEE: '100',
xdr: {
ScVal: {
scvString: jest.fn(),
scvVec: jest.fn(),
scvAddress: jest.fn(),
},
Address: {
fromString: jest.fn(() => ({
toScAddress: jest.fn()
}))
}
},
Address: jest.fn()
}))
jest.mock('@stellar/stellar-sdk/rpc', () => ({
Server: jest.fn(),
Api: {
isSimulationError: jest.fn()
},
assembleTransaction: jest.fn()
}))