forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1/* global jest */
2import 'react-native-gesture-handler/jestSetup'
3
4import {configure} from '@testing-library/react-native'
5
6configure({asyncUtilTimeout: 20000})
7
8jest.mock('@react-native-async-storage/async-storage', () =>
9 require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
10)
11jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter', () => {
12 // eslint-disable-next-line import-x/no-nodejs-modules
13 const {EventEmitter} = require('events')
14 return {
15 __esModule: true,
16 default: EventEmitter,
17 }
18})
19
20jest.mock('@fortawesome/react-native-fontawesome', () => ({
21 FontAwesomeIcon: '',
22}))
23
24jest.mock('react-native-safe-area-context', () => {
25 const inset = {top: 0, right: 0, bottom: 0, left: 0}
26 return {
27 SafeAreaProvider: jest.fn().mockImplementation(({children}) => children),
28 SafeAreaConsumer: jest
29 .fn()
30 .mockImplementation(({children}) => children(inset)),
31 useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
32 }
33})
34
35jest.mock('expo-file-system/legacy', () => ({
36 getInfoAsync: jest.fn().mockResolvedValue({exists: true, size: 100}),
37 deleteAsync: jest.fn(),
38 moveAsync: jest.fn().mockResolvedValue(undefined),
39 createDownloadResumable: jest.fn(),
40}))
41
42jest.mock('expo-image-manipulator', () => ({
43 manipulateAsync: jest.fn().mockResolvedValue({
44 uri: 'file://resized-image',
45 }),
46 SaveFormat: {
47 JPEG: 'jpeg',
48 WEBP: 'webp',
49 },
50}))
51
52jest.mock('expo-camera', () => ({
53 Camera: {
54 useCameraPermissions: jest.fn(() => [true]),
55 },
56}))
57
58jest.mock('expo-media-library', () => ({
59 __esModule: true, // this property makes it work
60 default: jest.fn(),
61 usePermissions: jest.fn(() => [true]),
62}))
63
64jest.mock('lande', () => ({
65 __esModule: true, // this property makes it work
66 default: jest.fn().mockReturnValue([['eng']]),
67}))
68
69jest.mock('sentry-expo', () => ({
70 init: () => jest.fn(),
71 Native: {
72 ReactNativeTracing: jest.fn().mockImplementation(() => ({
73 start: jest.fn(),
74 stop: jest.fn(),
75 })),
76 ReactNavigationInstrumentation: jest.fn(),
77 },
78}))
79
80jest.mock('crypto', () => ({}))
81
82jest.mock('expo-application', () => ({
83 nativeApplicationVersion: '1.0.0',
84 nativeBuildVersion: '1',
85}))
86
87jest.mock('expo-modules-core', () => ({
88 requireNativeModule: jest.fn().mockImplementation(moduleName => {
89 if (moduleName === 'ExpoPlatformInfo') {
90 return {
91 getIsReducedMotionEnabled: () => false,
92 }
93 }
94 if (moduleName === 'BottomSheet') {
95 return {
96 dismissAll: () => {},
97 }
98 }
99 }),
100 requireNativeViewManager: jest.fn().mockImplementation(_ => {
101 return () => null
102 }),
103 createPermissionHook: () => () => [true],
104}))
105
106jest.mock('expo-localization', () => ({
107 getLocales: () => [],
108}))