-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
58 lines (53 loc) · 1.54 KB
/
Copy pathjest.setup.js
File metadata and controls
58 lines (53 loc) · 1.54 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
// Mock expo-notifications
jest.mock('expo-notifications', () => ({
setNotificationChannelAsync: jest.fn(),
getPermissionsAsync: jest.fn(),
requestPermissionsAsync: jest.fn(),
setNotificationHandler: jest.fn(),
scheduleNotificationAsync: jest.fn(),
cancelScheduledNotificationAsync: jest.fn(),
getAllScheduledNotificationsAsync: jest.fn(),
getNextTriggerDateAsync: jest.fn(),
AndroidImportance: {
HIGH: 4,
},
SchedulableTriggerInputTypes: {
DATE: 'date',
},
}));
// Mock expo-intent-launcher
jest.mock('expo-intent-launcher', () => ({
startActivityAsync: jest.fn(),
}));
// Mock react-native Platform
jest.mock('react-native', () => ({
Platform: {
OS: 'ios',
select: jest.fn((obj) => obj.ios || obj.default),
},
}));
// Mock @react-native-async-storage/async-storage
jest.mock('@react-native-async-storage/async-storage', () => ({
__esModule: true,
default: {
getItem: jest.fn(),
setItem: jest.fn(),
removeItem: jest.fn(),
clear: jest.fn(),
},
}));
// Mock expo-crypto
let mockUuidCounter = 0;
jest.mock('expo-crypto', () => ({
randomUUID: jest.fn(() => `mock-uuid-${mockUuidCounter++}`),
}));
// Mock expo-speech-recognition
jest.mock('expo-speech-recognition', () => ({
getPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted' })),
requestPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted' })),
start: jest.fn(() => Promise.resolve()),
stop: jest.fn(() => Promise.resolve()),
addSpeechRecognitionListener: jest.fn(() => ({
remove: jest.fn(),
})),
}));