Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.eslintignorenode_modules
__tests__/
__mocks__/
.vscode/
android/
coverage/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/react-native-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
strategy:
matrix:
platform: [android, ios]
runs-on: ${{ matrix.platform == 'ios' && 'macos-14' || 'ubuntu-latest' }}
runs-on: ${{ matrix.platform == 'ios' && 'macos-15' || 'ubuntu-latest' }}
environment: RNBuild
steps:
- name: 🏗 Checkout repository
Expand Down
4 changes: 4 additions & 0 deletions .typescriptignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/**/*
**/node_modules/**/*
node_modules/@gluestack-ui/**/*
**/@gluestack-ui/**/*
19 changes: 0 additions & 19 deletions __mocks__/@/components/ui/actionsheet.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions __mocks__/@/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-nocheck
import React from 'react';

export function Avatar(props: any) {
return React.createElement('div', { ...props, style: { width: '48px', height: '48px', borderRadius: '50%', ...(props.style || {}) } }, props.children);
}

export function AvatarImage(props: any) {
return React.createElement('img', { ...props, alt: props.alt || '' });
}
6 changes: 6 additions & 0 deletions __mocks__/@/components/ui/box.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-nocheck
import React from 'react';

export function Box(props: any) {
return React.createElement('div', props, props.children);
}
Empty file.
10 changes: 10 additions & 0 deletions __mocks__/@/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-nocheck
import React from 'react';

export function Button(props: any) {
return React.createElement('button', { ...props, type: 'button' }, props.children);
}

export function ButtonText(props: any) {
return React.createElement('span', props, props.children);
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions __mocks__/@/components/ui/hstack.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-nocheck
import React from 'react';

export function HStack(props: any) {
return React.createElement('div', { ...props, style: { display: 'flex', flexDirection: 'row', ...(props.style || {}) } }, props.children);
}
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions __mocks__/@/components/ui/pressable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-nocheck
import React from 'react';

export function Pressable(props: any) {
return React.createElement('button', { ...props, type: 'button', onClick: props.onPress }, props.children);
}
6 changes: 6 additions & 0 deletions __mocks__/@/components/ui/text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-nocheck
import React from 'react';

export function Text(props: any) {
return React.createElement('span', props, props.children);
}
Empty file.
6 changes: 6 additions & 0 deletions __mocks__/@/components/ui/vstack.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-nocheck
import React from 'react';

export function VStack(props: any) {
return React.createElement('div', { ...props, style: { display: 'flex', flexDirection: 'column', ...(props.style || {}) } }, props.children);
}
44 changes: 44 additions & 0 deletions __mocks__/lucide-react-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Mock for lucide-react-native icons
const React = require('react');
const { View } = require('react-native');

const mockIcon = React.forwardRef((props: any, ref: any) => {
return React.createElement(View, { ...props, ref, testID: `icon-${props.testID || 'mock'}` });
});

export const AlertCircle = mockIcon;
export const Bell = mockIcon;
export const BuildingIcon = mockIcon;
export const CalendarIcon = mockIcon;
export const CheckCircle = mockIcon;
export const ChevronDownIcon = mockIcon;
export const ChevronRightIcon = mockIcon;
export const ChevronRight = mockIcon;
export const Circle = mockIcon;
export const ClockIcon = mockIcon;
export const Edit2Icon = mockIcon;
export const ExternalLink = mockIcon;
export const FileTextIcon = mockIcon;
export const GlobeIcon = mockIcon;
export const HomeIcon = mockIcon;
export const ImageIcon = mockIcon;
export const InfoIcon = mockIcon;
export const MailIcon = mockIcon;
export const MapPinIcon = mockIcon;
export const MessageCircle = mockIcon;
export const MoreVertical = mockIcon;
export const PaperclipIcon = mockIcon;
export const Phone = mockIcon;
export const PhoneIcon = mockIcon;
export const RouteIcon = mockIcon;
export const SettingsIcon = mockIcon;
export const SmartphoneIcon = mockIcon;
export const StarIcon = mockIcon;
export const TrashIcon = mockIcon;
export const Trash2 = mockIcon;
export const User = mockIcon;
export const UserCheck = mockIcon;
export const UserIcon = mockIcon;
export const Users = mockIcon;
export const UsersIcon = mockIcon;
export const X = mockIcon;
Comment on lines +9 to +44
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify all icon names used in app code are covered by this mock

Gaps will surface as “is not a function/undefined” at render-time in tests.


🏁 Script executed:

#!/bin/bash
# List names imported from lucide-react-native across the repo
rg -nP --type=ts --type=tsx -o "\{\K[^}]+(?=}\s+from\s+['\"]lucide-react-native['\"])" \
  | tr ',' '\n' | sed 's/as.*$//' | awk '{$1=$1};1' | sort -u > /tmp/icons_imported.txt

# List names exported by the mock
rg -nPo '(?<=export const )\w+' __mocks__/lucide-react-native.ts | sort -u > /tmp/icons_mocked.txt

echo "Missing in mock:"
comm -23 /tmp/icons_imported.txt /tmp/icons_mocked.txt || true

Length of output: 355


🏁 Script executed:

#!/bin/bash
# Find all unique icon imports from lucide-react-native in .ts and .tsx files
rg -nPo "\{\K[^}]+(?=}\s+from\s+['\"]lucide-react-native['\"])" --glob "*.ts" --glob "*.tsx" \
  | tr ',' '\n' \
  | sed 's/as.*$//' \
  | awk '{$1=$1};1' \
  | sort -u > /tmp/icons_imported.txt

# List names exported by the mock
rg -nPo '(?<=export const )\w+' __mocks__/lucide-react-native.ts \
  | sort -u > /tmp/icons_mocked.txt

echo "Missing in mock:"
comm -23 /tmp/icons_imported.txt /tmp/icons_mocked.txt || true

Length of output: 5397


Add missing mock exports for all used lucide-react-native icons
mocks/lucide-react-native.ts currently only covers a subset of the icons imported across the app—exports for icons like ArrowRight, Bell, BluetoothConnected, CalendarCheck, Car, Check, Circle, Clock, Contact, FileText, Loader2, MailOpen, Mic, PlusIcon, SearchIcon, XIcon, and many others are absent. Add an export for every icon your import-vs-mock script lists to prevent undefined/function errors in tests.

🤖 Prompt for AI Agents
In __mocks__/lucide-react-native.ts around lines 9 to 44, the mock file only
exports a subset of icons causing undefined/function errors in tests; add
exports for every icon listed by the import-vs-mock script (e.g., ArrowRight,
BluetoothConnected, CalendarCheck, Car, Check, Clock, Contact, FileText,
Loader2, MailOpen, Mic, PlusIcon, SearchIcon, XIcon, and any others the script
reports) using the same mockIcon value and exact export names used in imports so
tests see defined mocks; regenerate or re-run the import-vs-mock script output
to ensure completeness and keep exports in sync with actual imports.

16 changes: 16 additions & 0 deletions __mocks__/react-native-webview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const React = require('react');
const { View } = require('react-native');

// Mock implementation of WebView
const MockWebView = React.forwardRef((props, ref) => {
return React.createElement(View, {
...props,
ref,
testID: props.testID || 'webview-mock',
});
});

module.exports = {
WebView: MockWebView,
default: MockWebView,
};
63 changes: 63 additions & 0 deletions __mocks__/react-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Mock React Native for Jest testing environment
export const Platform = {
OS: 'ios',
select: jest.fn().mockImplementation((obj) => obj.ios || obj.default),
};

export const PermissionsAndroid = {
PERMISSIONS: {
BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT',
ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION',
},
RESULTS: {
GRANTED: 'granted',
DENIED: 'denied',
NEVER_ASK_AGAIN: 'never_ask_again',
},
requestMultiple: jest.fn(),
request: jest.fn(),
};

export const DeviceEventEmitter = {
addListener: jest.fn(),
removeAllListeners: jest.fn(),
emit: jest.fn(),
};

export const Alert = {
alert: jest.fn(),
};

export const Linking = {
canOpenURL: jest.fn().mockResolvedValue(true),
openURL: jest.fn().mockResolvedValue(undefined),
};

export const useColorScheme = jest.fn().mockReturnValue('light');

export const useWindowDimensions = jest.fn().mockReturnValue({
width: 375,
height: 812,
});

// Mock other commonly used React Native components
export const View = 'View';
export const Text = 'Text';
export const ScrollView = 'ScrollView';
export const StyleSheet = {
create: jest.fn().mockImplementation((styles) => styles),
};

// Export default
export default {
Platform,
PermissionsAndroid,
DeviceEventEmitter,
Alert,
Linking,
View,
Text,
StyleSheet,
useColorScheme,
};
3 changes: 2 additions & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
[
'expo-location',
{
locationWhenInUsePermission: 'Allow Resgird Responder to show current location on map.',
locationWhenInUsePermission: 'Allow Resgrid Responder to show current location on map.',
locationAlwaysAndWhenInUsePermission: 'Allow Resgrid Responder to use your location.',
locationAlwaysPermission: 'Resgrid Responder needs to track your location',
isIosBackgroundLocationEnabled: true,
Expand Down Expand Up @@ -265,6 +265,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
},
],
'react-native-ble-manager',
'expo-secure-store',
'@livekit/react-native-expo-plugin',
'@config-plugins/react-native-webrtc',
'@config-plugins/react-native-callkeep',
Expand Down
Loading