/** * Jest setup for Gitea Native. * * Native modules that cannot run in the Jest (Node) environment are mocked here. * Test-specific mocks (e.g. expo-secure-store) live next to the tests that need them * unless they are required globally. */ // AsyncStorage: official in-memory mock provided by the package. jest.mock('@react-native-async-storage/async-storage', () => require('@react-native-async-storage/async-storage/jest/async-storage-mock'), ); // Reanimated: minimal manual mock (the real package pulls native worklets). jest.mock('react-native-reanimated', () => { const { View } = require('react-native'); return { __esModule: true, default: { View, createAnimatedComponent: (component: unknown) => component }, useSharedValue: (value: unknown) => ({ value }), useAnimatedStyle: () => ({}), withTiming: (value: unknown) => value, withRepeat: (value: unknown) => value, withSequence: (...values: unknown[]) => values[values.length - 1], withDelay: (_delay: number, value: unknown) => value, cancelAnimation: () => undefined, runOnJS: (fn: unknown) => fn, runOnUI: (fn: unknown) => fn, Easing: { linear: () => 0, ease: () => 0, inOut: () => 0, out: () => 0, in: () => 0 }, }; }); // Safe area: official mock so SafeAreaView/useSafeAreaInsets work in tests. jest.mock('react-native-safe-area-context', () => require('react-native-safe-area-context/jest/mock')); // Haptics: no native module in Jest. jest.mock('expo-haptics', () => ({ selectionAsync: jest.fn(async () => undefined), impactAsync: jest.fn(async () => undefined), notificationAsync: jest.fn(async () => undefined), }));