-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathjest.setup.js
More file actions
46 lines (39 loc) · 1.12 KB
/
jest.setup.js
File metadata and controls
46 lines (39 loc) · 1.12 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
import '@testing-library/jest-dom'
import { TextEncoder, TextDecoder } from 'util'
jest.mock('@sentry/react', () => ({
init: jest.fn(),
captureException: jest.fn(),
ErrorBoundary: ({ children }) => children,
}))
// Mock environment variables for tests
process.env.SUPABASE_URL = 'https://test.supabase.co'
process.env.SUPABASE_SERVICE_ROLE_KEY = 'test-service-role-key'
process.env.PRIVY_APP_ID = 'test-privy-app-id'
process.env.INTERNAL_API_KEY = 'test-internal-api-key'
// Polyfill TextEncoder/TextDecoder for Node.js environment
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder
// Mock fetch for tests
global.fetch = jest.fn()
// Mock window.ethereum for wallet tests
Object.defineProperty(window, 'ethereum', {
writable: true,
value: {
request: jest.fn(),
on: jest.fn(),
removeListener: jest.fn(),
},
})
// Mock localStorage
Object.defineProperty(window, 'localStorage', {
value: {
getItem: jest.fn(),
setItem: jest.fn(),
removeItem: jest.fn(),
clear: jest.fn(),
},
writable: true,
})
// Suppress console warnings in tests
console.warn = jest.fn()
console.error = jest.fn()