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