86 lines
1.8 KiB
JavaScript
86 lines
1.8 KiB
JavaScript
require('@testing-library/jest-native/extend-expect')
|
|
|
|
// Mock react-native modules
|
|
// Note: NativeAnimatedHelper may not be needed in newer React Native versions
|
|
// jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
|
|
|
|
// Mock expo modules
|
|
jest.mock('expo-constants', () => ({
|
|
default: {},
|
|
}))
|
|
|
|
jest.mock('expo-linking', () => ({
|
|
createURL: (url) => url,
|
|
parse: (url) => ({ path: url }),
|
|
}))
|
|
|
|
jest.mock('expo-secure-store', () => ({
|
|
getItemAsync: jest.fn(),
|
|
setItemAsync: jest.fn(),
|
|
deleteItemAsync: jest.fn(),
|
|
}))
|
|
|
|
jest.mock('expo-font', () => ({
|
|
useFonts: () => [true, null],
|
|
}))
|
|
|
|
jest.mock('expo-splash-screen', () => ({
|
|
preventAutoHideAsync: jest.fn(),
|
|
hideAsync: jest.fn(),
|
|
}))
|
|
|
|
// Mock react-native-reanimated
|
|
jest.mock('react-native-reanimated', () => {
|
|
const Reanimated = require('react-native-reanimated/mock')
|
|
Reanimated.default.call = () => {}
|
|
return Reanimated
|
|
})
|
|
|
|
// Mock nativewind
|
|
jest.mock('nativewind', () => ({
|
|
styled: jest.fn(),
|
|
}))
|
|
|
|
// Mock @react-navigation/native
|
|
jest.mock('@react-navigation/native', () => ({
|
|
useNavigation: () => ({
|
|
navigate: jest.fn(),
|
|
goBack: jest.fn(),
|
|
reset: jest.fn(),
|
|
}),
|
|
useRoute: () => ({
|
|
params: {},
|
|
}),
|
|
NavigationContainer: ({ children }) => children,
|
|
}))
|
|
|
|
// Mock expo-router
|
|
jest.mock('expo-router', () => ({
|
|
useRouter: () => ({
|
|
push: jest.fn(),
|
|
replace: jest.fn(),
|
|
back: jest.fn(),
|
|
}),
|
|
useSegments: () => [],
|
|
usePathname: () => '/',
|
|
}))
|
|
|
|
// Global mock for console methods to reduce noise in tests
|
|
global.console = {
|
|
...console,
|
|
error: jest.fn(),
|
|
warn: jest.fn(),
|
|
log: jest.fn(),
|
|
}
|
|
|
|
// Mock @repo/core and @repo/sdk
|
|
jest.mock('@repo/core', () => ({
|
|
root: {
|
|
get: jest.fn(),
|
|
},
|
|
}))
|
|
|
|
jest.mock('@repo/sdk', () => ({
|
|
CategoryController: class MockCategoryController {},
|
|
}))
|