Functional verify+fix across both products after the build-out/harvest marathon. All 7 subprojects WORK (production build + tests + boot smoke). - gitgram-backend: fix 2FA backup-code lifecycle + QR-secret privacy regression, messageController reaction-aggregation crash; +4 test-harness updates for new models. Build clean, 1356/1356 tests, /health 200 - gitgram-web: fix render-time location/router.replace crash in app/camera prerender; next/link test mock. Production build green (216 pages), 76/86 tests - gitgram-mobile: add expo-haptics jest mock. tsc clean, 8/8 tests - aitm-core: fix IPv4/IPv6 authz test + a2aVendored auth-allowlist classification. 541/541 tests - aitm-api: vitest timeout bump for cold-transform false timeouts. 728/728 tests, /health 200 - aitm-mcp: correct beads_mark_done test (PUT not PATCH). 176/176 tests, boots - aitm-website: build green (93 pages) Deploy note: backend needs a Prisma migration for MutedWord/Post.contentLanguage/ MessageReaction (schema validates; generate against a migration-capable Postgres). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
123 lines
3.0 KiB
JavaScript
123 lines
3.0 KiB
JavaScript
import '@testing-library/jest-native/extend-expect';
|
|
|
|
// Mock AsyncStorage
|
|
jest.mock('@react-native-async-storage/async-storage', () =>
|
|
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
|
|
);
|
|
|
|
// Mock expo-router
|
|
jest.mock('expo-router', () => ({
|
|
useRouter: () => ({
|
|
push: jest.fn(),
|
|
replace: jest.fn(),
|
|
back: jest.fn(),
|
|
}),
|
|
useLocalSearchParams: () => ({}),
|
|
useSegments: () => [],
|
|
usePathname: () => '/',
|
|
Link: 'Link',
|
|
Stack: {
|
|
Screen: 'Screen',
|
|
},
|
|
}));
|
|
|
|
// Mock expo-image
|
|
jest.mock('expo-image', () => ({
|
|
Image: 'Image',
|
|
ImageSource: {},
|
|
}));
|
|
|
|
// Mock expo-constants
|
|
jest.mock('expo-constants', () => ({
|
|
__esModule: true,
|
|
default: {
|
|
expoConfig: {
|
|
extra: {},
|
|
},
|
|
easConfig: {},
|
|
},
|
|
}));
|
|
|
|
// Mock expo-notifications
|
|
jest.mock('expo-notifications', () => ({
|
|
setNotificationHandler: jest.fn(),
|
|
getPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted' })),
|
|
requestPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted' })),
|
|
getExpoPushTokenAsync: jest.fn(() => Promise.resolve({ data: 'ExponentPushToken[test]' })),
|
|
setNotificationChannelAsync: jest.fn(() => Promise.resolve()),
|
|
addNotificationReceivedListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
addNotificationResponseReceivedListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
cancelAllScheduledNotificationsAsync: jest.fn(() => Promise.resolve()),
|
|
setBadgeCountAsync: jest.fn(() => Promise.resolve()),
|
|
AndroidImportance: {
|
|
MAX: 'max',
|
|
},
|
|
}));
|
|
|
|
// Mock expo-device
|
|
jest.mock('expo-device', () => ({
|
|
isDevice: false,
|
|
deviceName: 'Test Device',
|
|
brand: 'Test',
|
|
modelName: 'Device',
|
|
}));
|
|
|
|
// Mock expo-clipboard
|
|
jest.mock('expo-clipboard', () => ({
|
|
setStringAsync: jest.fn(() => Promise.resolve()),
|
|
}));
|
|
|
|
// Mock expo-video
|
|
jest.mock('expo-video', () => ({
|
|
VideoView: 'VideoView',
|
|
useVideoPlayer: jest.fn(() => ({
|
|
play: jest.fn(),
|
|
pause: jest.fn(),
|
|
loop: false,
|
|
muted: false,
|
|
})),
|
|
}));
|
|
|
|
// Mock expo-image-picker
|
|
jest.mock('expo-image-picker', () => ({
|
|
requestMediaLibraryPermissionsAsync: jest.fn(() =>
|
|
Promise.resolve({ status: 'granted' })
|
|
),
|
|
launchImageLibraryAsync: jest.fn(() =>
|
|
Promise.resolve({
|
|
canceled: false,
|
|
assets: [{ uri: 'file://test-image.jpg' }],
|
|
})
|
|
),
|
|
}));
|
|
|
|
// Mock @react-native-community/netinfo
|
|
jest.mock('@react-native-community/netinfo', () => ({
|
|
fetch: jest.fn(() => Promise.resolve({ isConnected: true })),
|
|
addEventListener: jest.fn(() => jest.fn()),
|
|
}));
|
|
|
|
// Mock expo-haptics
|
|
jest.mock('expo-haptics', () => ({
|
|
ImpactFeedbackStyle: {
|
|
Light: 'light',
|
|
Medium: 'medium',
|
|
Heavy: 'heavy',
|
|
},
|
|
NotificationFeedbackType: {
|
|
Success: 'success',
|
|
Warning: 'warning',
|
|
Error: 'error',
|
|
},
|
|
impactAsync: jest.fn(() => Promise.resolve()),
|
|
notificationAsync: jest.fn(() => Promise.resolve()),
|
|
selectionAsync: jest.fn(() => Promise.resolve()),
|
|
}));
|
|
|
|
// Silence console warnings in tests
|
|
global.console = {
|
|
...console,
|
|
warn: jest.fn(),
|
|
error: jest.fn(),
|
|
};
|