An ATproto social media client -- with an independent Appview.
1/* global jest */
2import 'react-native-gesture-handler/jestSetup'
3// IMPORTANT: this is what's used in the native runtime
4import 'react-native-url-polyfill/auto'
5
6import {configure} from '@testing-library/react-native'
7
8configure({asyncUtilTimeout: 20000})
9
10jest.mock('@react-native-async-storage/async-storage', () =>
11 require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
12)
13jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter', () => {
14 const {EventEmitter} = require('events')
15 return {
16 __esModule: true,
17 default: EventEmitter,
18 }
19})
20
21jest.mock('@fortawesome/react-native-fontawesome', () => ({
22 FontAwesomeIcon: '',
23}))
24
25jest.mock('react-native-safe-area-context', () => {
26 const inset = {top: 0, right: 0, bottom: 0, left: 0}
27 return {
28 SafeAreaProvider: jest.fn().mockImplementation(({children}) => children),
29 SafeAreaConsumer: jest
30 .fn()
31 .mockImplementation(({children}) => children(inset)),
32 useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
33 }
34})
35
36jest.mock('expo-file-system/legacy', () => ({
37 getInfoAsync: jest.fn().mockResolvedValue({exists: true, size: 100}),
38 deleteAsync: jest.fn(),
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 },
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}))
103
104jest.mock('expo-localization', () => ({
105 getLocales: () => [],
106}))
107
108jest.mock('statsig-react-native-expo', () => ({
109 Statsig: {
110 initialize() {},
111 initializeCalled() {
112 return false
113 },
114 },
115}))
116
117jest.mock('../src/logger/bitdrift/lib', () => ({}))
118jest.mock('../src/lib/statsig/statsig', () => ({}))