Skip to content

Commit 096c556

Browse files
committed
RD-T42 PR#113 fixes
1 parent efe5a16 commit 096c556

5 files changed

Lines changed: 57 additions & 0 deletions

File tree

src/__tests__/app/call/[id].security.test.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@ import React from 'react';
55
jest.mock('react-native', () => ({
66
Platform: {
77
OS: 'ios',
8+
select: (obj: any) => obj.ios ?? obj.default,
9+
},
10+
PixelRatio: {
11+
getFontScale: () => 1,
12+
get: () => 2,
13+
roundToNearestPixel: (size: number) => size,
14+
},
15+
Dimensions: {
16+
get: () => ({ width: 375, height: 812, scale: 2, fontScale: 1 }),
17+
addEventListener: jest.fn(),
18+
removeEventListener: jest.fn(),
819
},
920
ScrollView: ({ children, ...props }: any) => <div {...props}>{children}</div>,
1021
StyleSheet: {
1122
create: (styles: any) => styles,
23+
flatten: (styles: any) => styles,
1224
},
1325
useWindowDimensions: () => ({ width: 375, height: 812 }),
1426
View: ({ children, ...props }: any) => <div {...props}>{children}</div>,
27+
Text: ({ children, ...props }: any) => <span {...props}>{children}</span>,
1528
}));
1629

1730
// Mock expo-router
@@ -153,6 +166,7 @@ jest.mock('react-i18next', () => ({
153166
}));
154167

155168
jest.mock('nativewind', () => ({
169+
cssInterop: jest.fn((Component: any) => Component),
156170
useColorScheme: () => ({ colorScheme: 'light' }),
157171
}));
158172

@@ -304,6 +318,36 @@ jest.mock('react-native-svg', () => ({
304318
Mixin: {},
305319
}));
306320

321+
// Mock @legendapp/motion
322+
jest.mock('@legendapp/motion', () => ({
323+
Motion: {
324+
View: jest.fn().mockImplementation(({ children }: any) => children),
325+
Text: jest.fn().mockImplementation(({ children }: any) => children),
326+
},
327+
AnimatePresence: jest.fn().mockImplementation(({ children }: any) => children),
328+
createMotionAnimatedComponent: jest.fn((Component: any) => Component),
329+
}));
330+
331+
// Mock bottom-sheet to avoid deep gluestack/actionsheet import chain
332+
jest.mock('@/components/ui/bottom-sheet', () => ({
333+
BottomSheet: ({ children }: any) => <div>{children}</div>,
334+
BottomSheetContent: ({ children }: any) => <div>{children}</div>,
335+
BottomSheetDragIndicator: () => null,
336+
BottomSheetDragIndicatorWrapper: ({ children }: any) => <div>{children}</div>,
337+
BottomSheetBackdrop: () => null,
338+
}));
339+
340+
// Mock video feeds tab to avoid actionsheet import chain
341+
jest.mock('@/components/callVideoFeeds/video-feeds-tab', () => ({
342+
__esModule: true,
343+
default: () => <div data-testid="video-feeds-tab">Video Feeds</div>,
344+
}));
345+
346+
// Mock check-in tab
347+
jest.mock('@/components/checkIn/check-in-tab', () => ({
348+
CheckInTab: () => <div data-testid="check-in-tab">Check In</div>,
349+
}));
350+
307351
import CallDetail from '../../../app/call/[id]';
308352

309353
describe('CallDetail', () => {

src/__tests__/app/call/[id].test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ import { useLocationStore } from '@/stores/app/location-store';
1111
import { useStatusBottomSheetStore } from '@/stores/status/store';
1212
import { useToastStore } from '@/stores/toast/store';
1313

14+
// Mock @legendapp/motion before importing CallDetail
15+
jest.mock('@legendapp/motion', () => ({
16+
Motion: {
17+
View: jest.fn().mockImplementation(({ children }) => children),
18+
Text: jest.fn().mockImplementation(({ children }) => children),
19+
},
20+
AnimatePresence: jest.fn().mockImplementation(({ children }) => children),
21+
createMotionAnimatedComponent: jest.fn((Component) => Component),
22+
}));
23+
1424
import CallDetail from '../../../app/call/[id]';
1525

1626

src/components/checkIn/__tests__/check-in-bottom-sheet.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jest.mock('react-i18next', () => ({
1010
}));
1111

1212
jest.mock('nativewind', () => ({
13+
cssInterop: jest.fn((Component: any) => Component),
1314
useColorScheme: () => ({ colorScheme: 'light' }),
1415
}));
1516

src/components/checkIn/__tests__/check-in-tab.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jest.mock('react-i18next', () => ({
1010
}));
1111

1212
jest.mock('nativewind', () => ({
13+
cssInterop: jest.fn((Component: any) => Component),
1314
useColorScheme: () => ({ colorScheme: 'light' }),
1415
}));
1516

src/components/checkIn/__tests__/check-in-timer-card.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jest.mock('react-i18next', () => ({
1515
}));
1616

1717
jest.mock('nativewind', () => ({
18+
cssInterop: jest.fn((Component: any) => Component),
1819
useColorScheme: () => ({ colorScheme: 'light' }),
1920
}));
2021

0 commit comments

Comments
 (0)