From d77a4e4a09ce836b8f1c253b780097784b5d14d7 Mon Sep 17 00:00:00 2001
From: Devasy Patel <110348311+Devasy23@users.noreply.github.com>
Date: Sat, 2 Aug 2025 23:23:07 +0530
Subject: [PATCH 1/5] feat: Implement friends balance retrieval and display in
FriendsScreen; enhance balance calculation logic
---
frontend/api/groups.js | 8 ++
frontend/screens/FriendsScreen.js | 102 ++++++++++++++++++-------
frontend/screens/GroupDetailsScreen.js | 4 +-
frontend/utils/balanceCalculator.js | 5 +-
4 files changed, 90 insertions(+), 29 deletions(-)
diff --git a/frontend/api/groups.js b/frontend/api/groups.js
index 7c04c3c4..a3dab453 100644
--- a/frontend/api/groups.js
+++ b/frontend/api/groups.js
@@ -82,3 +82,11 @@ export const getUserBalanceSummary = (token) => {
},
});
};
+
+export const getFriendsBalance = (token) => {
+ return apiClient.get('/users/me/friends-balance', {
+ headers: {
+ Authorization: `Bearer ${token}`,
+ },
+ });
+};
diff --git a/frontend/screens/FriendsScreen.js b/frontend/screens/FriendsScreen.js
index 8d6323ab..3c190ae3 100644
--- a/frontend/screens/FriendsScreen.js
+++ b/frontend/screens/FriendsScreen.js
@@ -1,38 +1,41 @@
import { useIsFocused } from '@react-navigation/native';
import { useContext, useEffect, useState } from 'react';
import { Alert, FlatList, StyleSheet, View } from 'react-native';
-import { ActivityIndicator, Appbar, Divider, List, Text } from 'react-native-paper';
-import { getGroupDetails, getGroups } from '../api/groups';
+import { ActivityIndicator, Appbar, Divider, IconButton, List, Text } from 'react-native-paper';
+import { getFriendsBalance } from '../api/groups';
import { AuthContext } from '../context/AuthContext';
-import { calculateFriendBalances } from '../utils/balanceCalculator';
const FriendsScreen = () => {
const { token, user } = useContext(AuthContext);
const [friends, setFriends] = useState([]);
const [isLoading, setIsLoading] = useState(true);
+ const [showTooltip, setShowTooltip] = useState(true);
const isFocused = useIsFocused();
useEffect(() => {
const fetchData = async () => {
setIsLoading(true);
try {
- const groupsResponse = await getGroups(token);
- const groups = groupsResponse.data.groups;
-
- const groupsWithDetails = await Promise.all(
- groups.map(async (group) => {
- const details = await getGroupDetails(token, group._id);
- return { ...group, id: group._id, details };
- })
- );
-
- // Use the utility function to calculate friend balances
- const calculatedFriends = calculateFriendBalances(groupsWithDetails, user._id);
- setFriends(calculatedFriends);
+ const friendsResponse = await getFriendsBalance(token);
+ const friendsData = friendsResponse.data.friendsBalance || [];
+
+ // Transform the backend data to match the expected frontend format
+ const transformedFriends = friendsData.map(friend => ({
+ id: friend.userId,
+ name: friend.userName,
+ netBalance: friend.netBalance,
+ groups: friend.breakdown.map(group => ({
+ id: group.groupId,
+ name: group.groupName,
+ balance: group.balance
+ }))
+ }));
+
+ setFriends(transformedFriends);
} catch (error) {
- console.error('Failed to fetch data for friends screen:', error);
- Alert.alert('Error', 'Failed to load friends data.');
+ console.error('Failed to fetch friends balance data:', error);
+ Alert.alert('Error', 'Failed to load friends balance data.');
} finally {
setIsLoading(false);
}
@@ -56,14 +59,22 @@ const FriendsScreen = () => {
descriptionStyle={{ color: item.netBalance !== 0 ? balanceColor : 'gray' }}
left={props => }
>
- {item.groups.map(group => (
- }
- />
- ))}
+ {item.groups.map(group => {
+ const groupBalanceColor = group.balance < 0 ? 'red' : 'green';
+ const groupBalanceText = group.balance < 0
+ ? `You owe $${Math.abs(group.balance).toFixed(2)}`
+ : `Owes you $${group.balance.toFixed(2)}`;
+
+ return (
+ }
+ />
+ );
+ })}
);
};
@@ -81,6 +92,22 @@ const FriendsScreen = () => {
+ {showTooltip && (
+
+
+
+ 💡 These amounts show your direct balance with each friend across all shared groups.
+ Check individual group details for optimized settlement suggestions.
+
+ setShowTooltip(false)}
+ style={styles.closeButton}
+ />
+
+
+ )}
{
const renderExpense = ({ item }) => {
const userSplit = item.splits.find(s => s.userId === user._id);
const userShare = userSplit ? userSplit.amount : 0;
- const paidByMe = item.createdBy === user._id;
+ const paidByMe = (item.paidBy || item.createdBy) === user._id;
const net = paidByMe ? item.amount - userShare : -userShare;
let balanceText;
@@ -74,7 +74,7 @@ const GroupDetailsScreen = ({ route, navigation }) => {
{item.description}
Amount: {formatCurrency(item.amount)}
- Paid by: {getMemberName(item.createdBy)}
+ Paid by: {getMemberName(item.paidBy || item.createdBy)}
{balanceText}
diff --git a/frontend/utils/balanceCalculator.js b/frontend/utils/balanceCalculator.js
index 48bc7320..3093dd8b 100644
--- a/frontend/utils/balanceCalculator.js
+++ b/frontend/utils/balanceCalculator.js
@@ -1,6 +1,9 @@
/**
* Utility functions for calculating friend balances across groups
* Includes comprehensive null safety checks to prevent runtime errors
+ *
+ * Note: Uses 'paidBy' field to determine who actually paid for an expense,
+ * with fallback to 'createdBy' for backward compatibility.
*/
/**
@@ -79,7 +82,7 @@ const getMemberName = (members, userId) => {
const processExpense = (expense, balances, members, group, currentUserId) => {
if (!expense || typeof expense !== 'object' || !currentUserId) return;
- const payerId = safeGet(expense, 'createdBy');
+ const payerId = safeGet(expense, 'paidBy') || safeGet(expense, 'createdBy');
const splits = safeGet(expense, 'splits');
if (!payerId || !Array.isArray(splits)) return;
From 20a73bfecf9b59498dbb28bc5e90c9c53867ffad Mon Sep 17 00:00:00 2001
From: Devasy Patel <110348311+Devasy23@users.noreply.github.com>
Date: Sat, 2 Aug 2025 23:24:56 +0530
Subject: [PATCH 2/5] feat: Update HomeScreen header to include group creation
and joining actions; remove redundant buttons
---
frontend/screens/HomeScreen.js | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/frontend/screens/HomeScreen.js b/frontend/screens/HomeScreen.js
index 54960a2e..226aea44 100644
--- a/frontend/screens/HomeScreen.js
+++ b/frontend/screens/HomeScreen.js
@@ -179,7 +179,8 @@ const HomeScreen = ({ navigation }) => {
-
+
+ navigation.navigate('JoinGroup', { onGroupJoined: fetchGroups })} />
{isLoading ? (
@@ -197,15 +198,6 @@ const HomeScreen = ({ navigation }) => {
refreshing={isLoading}
/>
)}
-
-
-
-
-
);
};
@@ -229,14 +221,6 @@ const styles = StyleSheet.create({
fontWeight: '500',
marginTop: 4,
},
- actions: {
- padding: 16,
- borderTopWidth: 1,
- borderTopColor: '#eee',
- },
- button: {
- marginTop: 8,
- },
emptyText: {
textAlign: 'center',
marginTop: 20,
From 11be2138f85c31d1f1f146f9f8b3fb1e3bd8a6e5 Mon Sep 17 00:00:00 2001
From: Devasy Patel <110348311+Devasy23@users.noreply.github.com>
Date: Sat, 2 Aug 2025 23:32:40 +0530
Subject: [PATCH 3/5] Remove package.json from frontend directory to clean up
unused dependencies
---
frontend/frontend/package-lock.json | 4566 ---------------------------
frontend/frontend/package.json | 10 -
2 files changed, 4576 deletions(-)
delete mode 100644 frontend/frontend/package-lock.json
delete mode 100644 frontend/frontend/package.json
diff --git a/frontend/frontend/package-lock.json b/frontend/frontend/package-lock.json
deleted file mode 100644
index 497c182d..00000000
--- a/frontend/frontend/package-lock.json
+++ /dev/null
@@ -1,4566 +0,0 @@
-{
- "name": "frontend",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {
- "": {
- "dependencies": {
- "@react-navigation/native": "^7.1.16",
- "@react-navigation/native-stack": "^7.3.23",
- "axios": "^1.11.0",
- "react-native-paper": "^5.14.5",
- "react-native-safe-area-context": "^5.5.2",
- "react-native-screens": "^4.13.1"
- }
- },
- "node_modules/@ampproject/remapping": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
- "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "@jridgewell/gen-mapping": "^0.3.5",
- "@jridgewell/trace-mapping": "^0.3.24"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@babel/code-frame": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
- "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.27.1",
- "js-tokens": "^4.0.0",
- "picocolors": "^1.1.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/compat-data": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz",
- "integrity": "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/core": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz",
- "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@ampproject/remapping": "^2.2.0",
- "@babel/code-frame": "^7.27.1",
- "@babel/generator": "^7.28.0",
- "@babel/helper-compilation-targets": "^7.27.2",
- "@babel/helper-module-transforms": "^7.27.3",
- "@babel/helpers": "^7.27.6",
- "@babel/parser": "^7.28.0",
- "@babel/template": "^7.27.2",
- "@babel/traverse": "^7.28.0",
- "@babel/types": "^7.28.0",
- "convert-source-map": "^2.0.0",
- "debug": "^4.1.0",
- "gensync": "^1.0.0-beta.2",
- "json5": "^2.2.3",
- "semver": "^6.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/babel"
- }
- },
- "node_modules/@babel/core/node_modules/semver": {
- "version": "6.3.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
- "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
- "license": "ISC",
- "peer": true,
- "bin": {
- "semver": "bin/semver.js"
- }
- },
- "node_modules/@babel/generator": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz",
- "integrity": "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/parser": "^7.28.0",
- "@babel/types": "^7.28.0",
- "@jridgewell/gen-mapping": "^0.3.12",
- "@jridgewell/trace-mapping": "^0.3.28",
- "jsesc": "^3.0.2"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-compilation-targets": {
- "version": "7.27.2",
- "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz",
- "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/compat-data": "^7.27.2",
- "@babel/helper-validator-option": "^7.27.1",
- "browserslist": "^4.24.0",
- "lru-cache": "^5.1.1",
- "semver": "^6.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-compilation-targets/node_modules/semver": {
- "version": "6.3.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
- "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
- "license": "ISC",
- "peer": true,
- "bin": {
- "semver": "bin/semver.js"
- }
- },
- "node_modules/@babel/helper-globals": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz",
- "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-module-imports": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz",
- "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/traverse": "^7.27.1",
- "@babel/types": "^7.27.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-module-transforms": {
- "version": "7.27.3",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz",
- "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-module-imports": "^7.27.1",
- "@babel/helper-validator-identifier": "^7.27.1",
- "@babel/traverse": "^7.27.3"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0"
- }
- },
- "node_modules/@babel/helper-plugin-utils": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz",
- "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-string-parser": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
- "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-validator-identifier": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
- "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-validator-option": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
- "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helpers": {
- "version": "7.28.2",
- "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.2.tgz",
- "integrity": "sha512-/V9771t+EgXz62aCcyofnQhGM8DQACbRhvzKFsXKC9QM+5MadF8ZmIm0crDMaz3+o0h0zXfJnd4EhbYbxsrcFw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/template": "^7.27.2",
- "@babel/types": "^7.28.2"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/parser": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz",
- "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/types": "^7.28.0"
- },
- "bin": {
- "parser": "bin/babel-parser.js"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@babel/plugin-syntax-async-generators": {
- "version": "7.8.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz",
- "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-bigint": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz",
- "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-class-properties": {
- "version": "7.12.13",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz",
- "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.12.13"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-class-static-block": {
- "version": "7.14.5",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz",
- "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.14.5"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-import-attributes": {
- "version": "7.27.1",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz",
- "integrity": "sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.27.1"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-import-meta": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz",
- "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.10.4"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-json-strings": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz",
- "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-logical-assignment-operators": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz",
- "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.10.4"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz",
- "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-numeric-separator": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz",
- "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.10.4"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-object-rest-spread": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz",
- "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-optional-catch-binding": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz",
- "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-optional-chaining": {
- "version": "7.8.3",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz",
- "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.8.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-private-property-in-object": {
- "version": "7.14.5",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz",
- "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.14.5"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/plugin-syntax-top-level-await": {
- "version": "7.14.5",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz",
- "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.14.5"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/runtime": {
- "version": "7.28.2",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.2.tgz",
- "integrity": "sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/template": {
- "version": "7.27.2",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
- "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/code-frame": "^7.27.1",
- "@babel/parser": "^7.27.2",
- "@babel/types": "^7.27.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/traverse": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz",
- "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/code-frame": "^7.27.1",
- "@babel/generator": "^7.28.0",
- "@babel/helper-globals": "^7.28.0",
- "@babel/parser": "^7.28.0",
- "@babel/template": "^7.27.2",
- "@babel/types": "^7.28.0",
- "debug": "^4.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/traverse--for-generate-function-map": {
- "name": "@babel/traverse",
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz",
- "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/code-frame": "^7.27.1",
- "@babel/generator": "^7.28.0",
- "@babel/helper-globals": "^7.28.0",
- "@babel/parser": "^7.28.0",
- "@babel/template": "^7.27.2",
- "@babel/types": "^7.28.0",
- "debug": "^4.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/types": {
- "version": "7.28.2",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.2.tgz",
- "integrity": "sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/helper-string-parser": "^7.27.1",
- "@babel/helper-validator-identifier": "^7.27.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@callstack/react-theme-provider": {
- "version": "3.0.9",
- "resolved": "https://registry.npmjs.org/@callstack/react-theme-provider/-/react-theme-provider-3.0.9.tgz",
- "integrity": "sha512-tTQ0uDSCL0ypeMa8T/E9wAZRGKWj8kXP7+6RYgPTfOPs9N07C9xM8P02GJ3feETap4Ux5S69D9nteq9mEj86NA==",
- "license": "MIT",
- "dependencies": {
- "deepmerge": "^3.2.0",
- "hoist-non-react-statics": "^3.3.0"
- },
- "peerDependencies": {
- "react": ">=16.3.0"
- }
- },
- "node_modules/@isaacs/ttlcache": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/@isaacs/ttlcache/-/ttlcache-1.4.1.tgz",
- "integrity": "sha512-RQgQ4uQ+pLbqXfOmieB91ejmLwvSgv9nLx6sT6sD83s7umBypgg+OIBOBbEUiJXrfpnp9j0mRhYYdzp9uqq3lA==",
- "license": "ISC",
- "peer": true,
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/@istanbuljs/load-nyc-config": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
- "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "camelcase": "^5.3.1",
- "find-up": "^4.1.0",
- "get-package-type": "^0.1.0",
- "js-yaml": "^3.13.1",
- "resolve-from": "^5.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@istanbuljs/schema": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
- "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@jest/create-cache-key-function": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz",
- "integrity": "sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/environment": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz",
- "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/fake-timers": "^29.7.0",
- "@jest/types": "^29.6.3",
- "@types/node": "*",
- "jest-mock": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/fake-timers": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz",
- "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3",
- "@sinonjs/fake-timers": "^10.0.2",
- "@types/node": "*",
- "jest-message-util": "^29.7.0",
- "jest-mock": "^29.7.0",
- "jest-util": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/schemas": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",
- "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@sinclair/typebox": "^0.27.8"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/transform": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz",
- "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/core": "^7.11.6",
- "@jest/types": "^29.6.3",
- "@jridgewell/trace-mapping": "^0.3.18",
- "babel-plugin-istanbul": "^6.1.1",
- "chalk": "^4.0.0",
- "convert-source-map": "^2.0.0",
- "fast-json-stable-stringify": "^2.1.0",
- "graceful-fs": "^4.2.9",
- "jest-haste-map": "^29.7.0",
- "jest-regex-util": "^29.6.3",
- "jest-util": "^29.7.0",
- "micromatch": "^4.0.4",
- "pirates": "^4.0.4",
- "slash": "^3.0.0",
- "write-file-atomic": "^4.0.2"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/types": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
- "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/schemas": "^29.6.3",
- "@types/istanbul-lib-coverage": "^2.0.0",
- "@types/istanbul-reports": "^3.0.0",
- "@types/node": "*",
- "@types/yargs": "^17.0.8",
- "chalk": "^4.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jridgewell/gen-mapping": {
- "version": "0.3.12",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
- "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jridgewell/sourcemap-codec": "^1.5.0",
- "@jridgewell/trace-mapping": "^0.3.24"
- }
- },
- "node_modules/@jridgewell/resolve-uri": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
- "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@jridgewell/source-map": {
- "version": "0.3.10",
- "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.10.tgz",
- "integrity": "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jridgewell/gen-mapping": "^0.3.5",
- "@jridgewell/trace-mapping": "^0.3.25"
- }
- },
- "node_modules/@jridgewell/sourcemap-codec": {
- "version": "1.5.4",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz",
- "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@jridgewell/trace-mapping": {
- "version": "0.3.29",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz",
- "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jridgewell/resolve-uri": "^3.1.0",
- "@jridgewell/sourcemap-codec": "^1.4.14"
- }
- },
- "node_modules/@react-native/assets-registry": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.80.2.tgz",
- "integrity": "sha512-+sI2zIM22amhkZqW+RpD3qDoopeRiezrTtZMP+Y3HI+6/2JbEq7DdyV/2YS1lrSSdyy3STW2V37Lt4dKqP0lEQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@react-native/codegen": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/codegen/-/codegen-0.80.2.tgz",
- "integrity": "sha512-eYad9ex9/RS6oFbbpu6LxsczktbhfJbJlTvtRlcWLJjJbFTeNr5Q7CgBT2/m5VtpxnJ/0YdmZ9vdazsJ2yp9kw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "glob": "^7.1.1",
- "hermes-parser": "0.28.1",
- "invariant": "^2.2.4",
- "nullthrows": "^1.1.1",
- "yargs": "^17.6.2"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "@babel/core": "*"
- }
- },
- "node_modules/@react-native/community-cli-plugin": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/community-cli-plugin/-/community-cli-plugin-0.80.2.tgz",
- "integrity": "sha512-UBjsE+lv1YtThs56mgFaUdWv0jNE1oO58Lkbf3dn47F0e7YiTubIcvP6AnlaMhZF2Pmt9ky8J1jTpgItO9tGeg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@react-native/dev-middleware": "0.80.2",
- "chalk": "^4.0.0",
- "debug": "^4.4.0",
- "invariant": "^2.2.4",
- "metro": "^0.82.2",
- "metro-config": "^0.82.2",
- "metro-core": "^0.82.2",
- "semver": "^7.1.3"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "@react-native-community/cli": "*"
- },
- "peerDependenciesMeta": {
- "@react-native-community/cli": {
- "optional": true
- }
- }
- },
- "node_modules/@react-native/debugger-frontend": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/debugger-frontend/-/debugger-frontend-0.80.2.tgz",
- "integrity": "sha512-n3D88bqNk0bY+YjNxbM6giqva06xj+rgEfu91Pg+nJ0szSL2eLl7ULERJqI3hxFt0XGuTpTOxZgw/Po5maXa4g==",
- "license": "BSD-3-Clause",
- "peer": true,
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@react-native/dev-middleware": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/dev-middleware/-/dev-middleware-0.80.2.tgz",
- "integrity": "sha512-8OeBEZNiApdbZaqTrrzeyFwXn/JwgJox7jdtjVAH56DggTVJXdbnyUjQ4ts6XAacEQgpFOAskoO730eyafOkAA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@isaacs/ttlcache": "^1.4.1",
- "@react-native/debugger-frontend": "0.80.2",
- "chrome-launcher": "^0.15.2",
- "chromium-edge-launcher": "^0.2.0",
- "connect": "^3.6.5",
- "debug": "^4.4.0",
- "invariant": "^2.2.4",
- "nullthrows": "^1.1.1",
- "open": "^7.0.3",
- "serve-static": "^1.16.2",
- "ws": "^6.2.3"
- },
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@react-native/gradle-plugin": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.80.2.tgz",
- "integrity": "sha512-C5/FYbIfCXPFjF/hIcWFKC9rEadDDhPMbxE7tarGR9tmYKyb9o7fYvfNe8fFgbCRKelMHP0ShATz3T73pHHDfA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@react-native/js-polyfills": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/js-polyfills/-/js-polyfills-0.80.2.tgz",
- "integrity": "sha512-f63M3paxHK92p6L9o+AY7hV/YojCZAhb+fdDpSfOtDtCngWbBhd6foJrO6IybzDFERxlwErupUg3pqr5w3KJWw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@react-native/normalize-colors": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/normalize-colors/-/normalize-colors-0.80.2.tgz",
- "integrity": "sha512-08Ax7554Z31NXi5SQ6h1GsiSrlZEOYHQNSC7u+x91Tdiq87IXldW8Ib1N3ThXoDcD8bjr+I+MdlabEJw36/fFg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@react-native/virtualized-lists": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/@react-native/virtualized-lists/-/virtualized-lists-0.80.2.tgz",
- "integrity": "sha512-kXsIV2eB73QClbbH/z/lRhZkyj3Dke4tarM5w2yXSNwJthMPMfj4KqLZ6Lnf0nmPPjz7qo/voKtlrGqlM822Rg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "invariant": "^2.2.4",
- "nullthrows": "^1.1.1"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "@types/react": "^19.0.0",
- "react": "*",
- "react-native": "*"
- },
- "peerDependenciesMeta": {
- "@types/react": {
- "optional": true
- }
- }
- },
- "node_modules/@react-navigation/core": {
- "version": "7.12.3",
- "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-7.12.3.tgz",
- "integrity": "sha512-oEz5sL8KTYmCv8SQX1A4k75A7VzYadOCudp/ewOBqRXOmZdxDQA9JuN7baE9IVyaRW0QTVDy+N/Wnqx9F4aW6A==",
- "license": "MIT",
- "dependencies": {
- "@react-navigation/routers": "^7.5.1",
- "escape-string-regexp": "^4.0.0",
- "nanoid": "^3.3.11",
- "query-string": "^7.1.3",
- "react-is": "^19.1.0",
- "use-latest-callback": "^0.2.4",
- "use-sync-external-store": "^1.5.0"
- },
- "peerDependencies": {
- "react": ">= 18.2.0"
- }
- },
- "node_modules/@react-navigation/elements": {
- "version": "2.6.1",
- "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-2.6.1.tgz",
- "integrity": "sha512-kVbIo+5FaqJv6MiYUR6nQHiw+10dmmH/P10C29wrH9S6fr7k69fImHGeiOI/h7SMDJ2vjWhftyEjqYO+c2LG/w==",
- "license": "MIT",
- "dependencies": {
- "color": "^4.2.3",
- "use-latest-callback": "^0.2.4",
- "use-sync-external-store": "^1.5.0"
- },
- "peerDependencies": {
- "@react-native-masked-view/masked-view": ">= 0.2.0",
- "@react-navigation/native": "^7.1.16",
- "react": ">= 18.2.0",
- "react-native": "*",
- "react-native-safe-area-context": ">= 4.0.0"
- },
- "peerDependenciesMeta": {
- "@react-native-masked-view/masked-view": {
- "optional": true
- }
- }
- },
- "node_modules/@react-navigation/native": {
- "version": "7.1.16",
- "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-7.1.16.tgz",
- "integrity": "sha512-JnnK81JYJ6PiMsuBEshPGHwfagRnH8W7SYdWNrPxQdNtakkHtG4u0O9FmrOnKiPl45DaftCcH1g+OVTFFgWa0Q==",
- "license": "MIT",
- "dependencies": {
- "@react-navigation/core": "^7.12.3",
- "escape-string-regexp": "^4.0.0",
- "fast-deep-equal": "^3.1.3",
- "nanoid": "^3.3.11",
- "use-latest-callback": "^0.2.4"
- },
- "peerDependencies": {
- "react": ">= 18.2.0",
- "react-native": "*"
- }
- },
- "node_modules/@react-navigation/native-stack": {
- "version": "7.3.23",
- "resolved": "https://registry.npmjs.org/@react-navigation/native-stack/-/native-stack-7.3.23.tgz",
- "integrity": "sha512-WQBBnPrlM0vXj5YAFnJTyrkiCyANl2KnBV8ZmUG61HkqXFwuBbnHij6eoggXH1VZkEVRxW8k0E3qqfPtEZfUjQ==",
- "license": "MIT",
- "dependencies": {
- "@react-navigation/elements": "^2.6.1",
- "warn-once": "^0.1.1"
- },
- "peerDependencies": {
- "@react-navigation/native": "^7.1.16",
- "react": ">= 18.2.0",
- "react-native": "*",
- "react-native-safe-area-context": ">= 4.0.0",
- "react-native-screens": ">= 4.0.0"
- }
- },
- "node_modules/@react-navigation/routers": {
- "version": "7.5.1",
- "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-7.5.1.tgz",
- "integrity": "sha512-pxipMW/iEBSUrjxz2cDD7fNwkqR4xoi0E/PcfTQGCcdJwLoaxzab5kSadBLj1MTJyT0YRrOXL9umHpXtp+Dv4w==",
- "license": "MIT",
- "dependencies": {
- "nanoid": "^3.3.11"
- }
- },
- "node_modules/@sinclair/typebox": {
- "version": "0.27.8",
- "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
- "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@sinonjs/commons": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz",
- "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==",
- "license": "BSD-3-Clause",
- "peer": true,
- "dependencies": {
- "type-detect": "4.0.8"
- }
- },
- "node_modules/@sinonjs/fake-timers": {
- "version": "10.3.0",
- "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz",
- "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==",
- "license": "BSD-3-Clause",
- "peer": true,
- "dependencies": {
- "@sinonjs/commons": "^3.0.0"
- }
- },
- "node_modules/@types/babel__core": {
- "version": "7.20.5",
- "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
- "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/parser": "^7.20.7",
- "@babel/types": "^7.20.7",
- "@types/babel__generator": "*",
- "@types/babel__template": "*",
- "@types/babel__traverse": "*"
- }
- },
- "node_modules/@types/babel__generator": {
- "version": "7.27.0",
- "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
- "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/types": "^7.0.0"
- }
- },
- "node_modules/@types/babel__template": {
- "version": "7.4.4",
- "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
- "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/parser": "^7.1.0",
- "@babel/types": "^7.0.0"
- }
- },
- "node_modules/@types/babel__traverse": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz",
- "integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/types": "^7.20.7"
- }
- },
- "node_modules/@types/graceful-fs": {
- "version": "4.1.9",
- "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
- "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@types/node": "*"
- }
- },
- "node_modules/@types/istanbul-lib-coverage": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
- "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@types/istanbul-lib-report": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz",
- "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@types/istanbul-lib-coverage": "*"
- }
- },
- "node_modules/@types/istanbul-reports": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz",
- "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@types/istanbul-lib-report": "*"
- }
- },
- "node_modules/@types/node": {
- "version": "24.1.0",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
- "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "undici-types": "~7.8.0"
- }
- },
- "node_modules/@types/stack-utils": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz",
- "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@types/yargs": {
- "version": "17.0.33",
- "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz",
- "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@types/yargs-parser": "*"
- }
- },
- "node_modules/@types/yargs-parser": {
- "version": "21.0.3",
- "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
- "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/abort-controller": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
- "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "event-target-shim": "^5.0.0"
- },
- "engines": {
- "node": ">=6.5"
- }
- },
- "node_modules/accepts": {
- "version": "1.3.8",
- "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
- "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "mime-types": "~2.1.34",
- "negotiator": "0.6.3"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/acorn": {
- "version": "8.15.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
- "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "acorn": "bin/acorn"
- },
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/agent-base": {
- "version": "7.1.4",
- "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
- "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 14"
- }
- },
- "node_modules/anser": {
- "version": "1.4.10",
- "resolved": "https://registry.npmjs.org/anser/-/anser-1.4.10.tgz",
- "integrity": "sha512-hCv9AqTQ8ycjpSd3upOJd7vFwW1JaoYQ7tpham03GJ1ca8/65rqn0RpaWpItOAd6ylW9wAw6luXYPJIyPFVOww==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/anymatch": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
- "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "normalize-path": "^3.0.0",
- "picomatch": "^2.0.4"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/argparse": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
- "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "sprintf-js": "~1.0.2"
- }
- },
- "node_modules/asap": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
- "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/async-limiter": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
- "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/asynckit": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "license": "MIT"
- },
- "node_modules/axios": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz",
- "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==",
- "license": "MIT",
- "dependencies": {
- "follow-redirects": "^1.15.6",
- "form-data": "^4.0.4",
- "proxy-from-env": "^1.1.0"
- }
- },
- "node_modules/babel-jest": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz",
- "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/transform": "^29.7.0",
- "@types/babel__core": "^7.1.14",
- "babel-plugin-istanbul": "^6.1.1",
- "babel-preset-jest": "^29.6.3",
- "chalk": "^4.0.0",
- "graceful-fs": "^4.2.9",
- "slash": "^3.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.8.0"
- }
- },
- "node_modules/babel-plugin-istanbul": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz",
- "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==",
- "license": "BSD-3-Clause",
- "peer": true,
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.0.0",
- "@istanbuljs/load-nyc-config": "^1.0.0",
- "@istanbuljs/schema": "^0.1.2",
- "istanbul-lib-instrument": "^5.0.4",
- "test-exclude": "^6.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/babel-plugin-jest-hoist": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz",
- "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/template": "^7.3.3",
- "@babel/types": "^7.3.3",
- "@types/babel__core": "^7.1.14",
- "@types/babel__traverse": "^7.0.6"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/babel-plugin-syntax-hermes-parser": {
- "version": "0.28.1",
- "resolved": "https://registry.npmjs.org/babel-plugin-syntax-hermes-parser/-/babel-plugin-syntax-hermes-parser-0.28.1.tgz",
- "integrity": "sha512-meT17DOuUElMNsL5LZN56d+KBp22hb0EfxWfuPUeoSi54e40v1W4C2V36P75FpsH9fVEfDKpw5Nnkahc8haSsQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "hermes-parser": "0.28.1"
- }
- },
- "node_modules/babel-preset-current-node-syntax": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.1.tgz",
- "integrity": "sha512-23fWKohMTvS5s0wwJKycOe0dBdCwQ6+iiLaNR9zy8P13mtFRFM9qLLX6HJX5DL2pi/FNDf3fCQHM4FIMoHH/7w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/plugin-syntax-async-generators": "^7.8.4",
- "@babel/plugin-syntax-bigint": "^7.8.3",
- "@babel/plugin-syntax-class-properties": "^7.12.13",
- "@babel/plugin-syntax-class-static-block": "^7.14.5",
- "@babel/plugin-syntax-import-attributes": "^7.24.7",
- "@babel/plugin-syntax-import-meta": "^7.10.4",
- "@babel/plugin-syntax-json-strings": "^7.8.3",
- "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
- "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
- "@babel/plugin-syntax-numeric-separator": "^7.10.4",
- "@babel/plugin-syntax-object-rest-spread": "^7.8.3",
- "@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
- "@babel/plugin-syntax-optional-chaining": "^7.8.3",
- "@babel/plugin-syntax-private-property-in-object": "^7.14.5",
- "@babel/plugin-syntax-top-level-await": "^7.14.5"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0 || ^8.0.0-0"
- }
- },
- "node_modules/babel-preset-jest": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz",
- "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "babel-plugin-jest-hoist": "^29.6.3",
- "babel-preset-current-node-syntax": "^1.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0"
- }
- },
- "node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/base64-js": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
- "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "peer": true
- },
- "node_modules/brace-expansion": {
- "version": "1.1.12",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
- "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
- "node_modules/braces": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
- "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "fill-range": "^7.1.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/browserslist": {
- "version": "4.25.1",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz",
- "integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==",
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/browserslist"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "caniuse-lite": "^1.0.30001726",
- "electron-to-chromium": "^1.5.173",
- "node-releases": "^2.0.19",
- "update-browserslist-db": "^1.1.3"
- },
- "bin": {
- "browserslist": "cli.js"
- },
- "engines": {
- "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
- }
- },
- "node_modules/bser": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
- "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "node-int64": "^0.4.0"
- }
- },
- "node_modules/buffer-from": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
- "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/call-bind-apply-helpers": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
- "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
- "license": "MIT",
- "dependencies": {
- "es-errors": "^1.3.0",
- "function-bind": "^1.1.2"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/caller-callsite": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
- "integrity": "sha512-JuG3qI4QOftFsZyOn1qq87fq5grLIyk1JYd5lJmdA+fG7aQ9pA/i3JIJGcO3q0MrRcHlOt1U+ZeHW8Dq9axALQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "callsites": "^2.0.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/caller-path": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz",
- "integrity": "sha512-MCL3sf6nCSXOwCTzvPKhN18TU7AHTvdtam8DAogxcrJ8Rjfbbg7Lgng64H9Iy+vUV6VGFClN/TyxBkAebLRR4A==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "caller-callsite": "^2.0.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/callsites": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz",
- "integrity": "sha512-ksWePWBloaWPxJYQ8TL0JHvtci6G5QTKwQ95RcWAa/lzoAKuAOflGdAK92hpHXjkwb8zLxoLNUoNYZgVsaJzvQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/caniuse-lite": {
- "version": "1.0.30001731",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz",
- "integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==",
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "CC-BY-4.0",
- "peer": true
- },
- "node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/chrome-launcher": {
- "version": "0.15.2",
- "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.15.2.tgz",
- "integrity": "sha512-zdLEwNo3aUVzIhKhTtXfxhdvZhUghrnmkvcAq2NoDd+LeOHKf03H5jwZ8T/STsAlzyALkBVK552iaG1fGf1xVQ==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "@types/node": "*",
- "escape-string-regexp": "^4.0.0",
- "is-wsl": "^2.2.0",
- "lighthouse-logger": "^1.0.0"
- },
- "bin": {
- "print-chrome-path": "bin/print-chrome-path.js"
- },
- "engines": {
- "node": ">=12.13.0"
- }
- },
- "node_modules/chromium-edge-launcher": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/chromium-edge-launcher/-/chromium-edge-launcher-0.2.0.tgz",
- "integrity": "sha512-JfJjUnq25y9yg4FABRRVPmBGWPZZi+AQXT4mxupb67766/0UlhG8PAZCz6xzEMXTbW3CsSoE8PcCWA49n35mKg==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "@types/node": "*",
- "escape-string-regexp": "^4.0.0",
- "is-wsl": "^2.2.0",
- "lighthouse-logger": "^1.0.0",
- "mkdirp": "^1.0.4",
- "rimraf": "^3.0.2"
- }
- },
- "node_modules/ci-info": {
- "version": "3.9.0",
- "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
- "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/sibiraj-s"
- }
- ],
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/cliui": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
- "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "string-width": "^4.2.0",
- "strip-ansi": "^6.0.1",
- "wrap-ansi": "^7.0.0"
- },
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/color": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
- "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^2.0.1",
- "color-string": "^1.9.0"
- },
- "engines": {
- "node": ">=12.5.0"
- }
- },
- "node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "license": "MIT",
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "license": "MIT"
- },
- "node_modules/color-string": {
- "version": "1.9.1",
- "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
- "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
- "license": "MIT",
- "dependencies": {
- "color-name": "^1.0.0",
- "simple-swizzle": "^0.2.2"
- }
- },
- "node_modules/combined-stream": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
- "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "license": "MIT",
- "dependencies": {
- "delayed-stream": "~1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/commander": {
- "version": "12.1.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
- "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/concat-map": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
- "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/connect": {
- "version": "3.7.0",
- "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz",
- "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "debug": "2.6.9",
- "finalhandler": "1.1.2",
- "parseurl": "~1.3.3",
- "utils-merge": "1.0.1"
- },
- "engines": {
- "node": ">= 0.10.0"
- }
- },
- "node_modules/connect/node_modules/debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ms": "2.0.0"
- }
- },
- "node_modules/connect/node_modules/ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/convert-source-map": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
- "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/cosmiconfig": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",
- "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "import-fresh": "^2.0.0",
- "is-directory": "^0.3.1",
- "js-yaml": "^3.13.1",
- "parse-json": "^4.0.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/debug": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
- "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ms": "^2.1.3"
- },
- "engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
- }
- },
- "node_modules/decode-uri-component": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
- "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10"
- }
- },
- "node_modules/deepmerge": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.3.0.tgz",
- "integrity": "sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/delayed-stream": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
- "license": "MIT",
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/depd": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
- "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/destroy": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
- "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8",
- "npm": "1.2.8000 || >= 1.4.16"
- }
- },
- "node_modules/dunder-proto": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
- "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
- "license": "MIT",
- "dependencies": {
- "call-bind-apply-helpers": "^1.0.1",
- "es-errors": "^1.3.0",
- "gopd": "^1.2.0"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/ee-first": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
- "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/electron-to-chromium": {
- "version": "1.5.192",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.192.tgz",
- "integrity": "sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/encodeurl": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/error-ex": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
- "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "is-arrayish": "^0.2.1"
- }
- },
- "node_modules/error-stack-parser": {
- "version": "2.1.4",
- "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz",
- "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "stackframe": "^1.3.4"
- }
- },
- "node_modules/es-define-property": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
- "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/es-errors": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
- "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/es-object-atoms": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
- "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
- "license": "MIT",
- "dependencies": {
- "es-errors": "^1.3.0"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/es-set-tostringtag": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
- "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
- "license": "MIT",
- "dependencies": {
- "es-errors": "^1.3.0",
- "get-intrinsic": "^1.2.6",
- "has-tostringtag": "^1.0.2",
- "hasown": "^2.0.2"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/escalade": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
- "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/escape-html": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
- "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/escape-string-regexp": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
- "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
- "license": "MIT",
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/esprima": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
- "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
- "license": "BSD-2-Clause",
- "peer": true,
- "bin": {
- "esparse": "bin/esparse.js",
- "esvalidate": "bin/esvalidate.js"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/etag": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
- "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/event-target-shim": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
- "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/exponential-backoff": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz",
- "integrity": "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA==",
- "license": "Apache-2.0",
- "peer": true
- },
- "node_modules/fast-deep-equal": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
- "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
- "license": "MIT"
- },
- "node_modules/fast-json-stable-stringify": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
- "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/fb-watchman": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
- "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "bser": "2.1.1"
- }
- },
- "node_modules/fill-range": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
- "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "to-regex-range": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/filter-obj": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz",
- "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/finalhandler": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
- "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "debug": "2.6.9",
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "on-finished": "~2.3.0",
- "parseurl": "~1.3.3",
- "statuses": "~1.5.0",
- "unpipe": "~1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/finalhandler/node_modules/debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ms": "2.0.0"
- }
- },
- "node_modules/finalhandler/node_modules/ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/find-up": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/flow-enums-runtime": {
- "version": "0.0.6",
- "resolved": "https://registry.npmjs.org/flow-enums-runtime/-/flow-enums-runtime-0.0.6.tgz",
- "integrity": "sha512-3PYnM29RFXwvAN6Pc/scUfkI7RwhQ/xqyLUyPNlXUp9S40zI8nup9tUSrTLSVnWGBN38FNiGWbwZOB6uR4OGdw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/follow-redirects": {
- "version": "1.15.9",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
- "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
- "funding": [
- {
- "type": "individual",
- "url": "https://github.com/sponsors/RubenVerborgh"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=4.0"
- },
- "peerDependenciesMeta": {
- "debug": {
- "optional": true
- }
- }
- },
- "node_modules/form-data": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
- "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
- "license": "MIT",
- "dependencies": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.8",
- "es-set-tostringtag": "^2.1.0",
- "hasown": "^2.0.2",
- "mime-types": "^2.1.12"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/fresh": {
- "version": "0.5.2",
- "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
- "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/fs.realpath": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
- "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/fsevents": {
- "version": "2.3.3",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
- "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
- "hasInstallScript": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "peer": true,
- "engines": {
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
- }
- },
- "node_modules/function-bind": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
- "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
- "license": "MIT",
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/gensync": {
- "version": "1.0.0-beta.2",
- "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
- "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/get-caller-file": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
- "license": "ISC",
- "peer": true,
- "engines": {
- "node": "6.* || 8.* || >= 10.*"
- }
- },
- "node_modules/get-intrinsic": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
- "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
- "license": "MIT",
- "dependencies": {
- "call-bind-apply-helpers": "^1.0.2",
- "es-define-property": "^1.0.1",
- "es-errors": "^1.3.0",
- "es-object-atoms": "^1.1.1",
- "function-bind": "^1.1.2",
- "get-proto": "^1.0.1",
- "gopd": "^1.2.0",
- "has-symbols": "^1.1.0",
- "hasown": "^2.0.2",
- "math-intrinsics": "^1.1.0"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/get-package-type": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz",
- "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8.0.0"
- }
- },
- "node_modules/get-proto": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
- "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
- "license": "MIT",
- "dependencies": {
- "dunder-proto": "^1.0.1",
- "es-object-atoms": "^1.0.0"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/glob": {
- "version": "7.2.3",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
- "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
- "deprecated": "Glob versions prior to v9 are no longer supported",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^3.1.1",
- "once": "^1.3.0",
- "path-is-absolute": "^1.0.0"
- },
- "engines": {
- "node": "*"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/gopd": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
- "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/graceful-fs": {
- "version": "4.2.11",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
- "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/has-symbols": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
- "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/has-tostringtag": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
- "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
- "license": "MIT",
- "dependencies": {
- "has-symbols": "^1.0.3"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/hasown": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
- "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
- "license": "MIT",
- "dependencies": {
- "function-bind": "^1.1.2"
- },
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/hermes-estree": {
- "version": "0.28.1",
- "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.28.1.tgz",
- "integrity": "sha512-w3nxl/RGM7LBae0v8LH2o36+8VqwOZGv9rX1wyoWT6YaKZLqpJZ0YQ5P0LVr3tuRpf7vCx0iIG4i/VmBJejxTQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/hermes-parser": {
- "version": "0.28.1",
- "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.28.1.tgz",
- "integrity": "sha512-nf8o+hE8g7UJWParnccljHumE9Vlq8F7MqIdeahl+4x0tvCUJYRrT0L7h0MMg/X9YJmkNwsfbaNNrzPtFXOscg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "hermes-estree": "0.28.1"
- }
- },
- "node_modules/hoist-non-react-statics": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
- "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
- "license": "BSD-3-Clause",
- "dependencies": {
- "react-is": "^16.7.0"
- }
- },
- "node_modules/hoist-non-react-statics/node_modules/react-is": {
- "version": "16.13.1",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
- "license": "MIT"
- },
- "node_modules/http-errors": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
- "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "depd": "2.0.0",
- "inherits": "2.0.4",
- "setprototypeof": "1.2.0",
- "statuses": "2.0.1",
- "toidentifier": "1.0.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/http-errors/node_modules/statuses": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
- "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/https-proxy-agent": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
- "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "agent-base": "^7.1.2",
- "debug": "4"
- },
- "engines": {
- "node": ">= 14"
- }
- },
- "node_modules/image-size": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.2.1.tgz",
- "integrity": "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "queue": "6.0.2"
- },
- "bin": {
- "image-size": "bin/image-size.js"
- },
- "engines": {
- "node": ">=16.x"
- }
- },
- "node_modules/import-fresh": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz",
- "integrity": "sha512-eZ5H8rcgYazHbKC3PG4ClHNykCSxtAhxSSEM+2mb+7evD2CKF5V7c0dNum7AdpDh0ZdICwZY9sRSn8f+KH96sg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "caller-path": "^2.0.0",
- "resolve-from": "^3.0.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/import-fresh/node_modules/resolve-from": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
- "integrity": "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/imurmurhash": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
- "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.8.19"
- }
- },
- "node_modules/inflight": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
- "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
- "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "node_modules/inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/invariant": {
- "version": "2.2.4",
- "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
- "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "loose-envify": "^1.0.0"
- }
- },
- "node_modules/is-arrayish": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
- "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/is-directory": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz",
- "integrity": "sha512-yVChGzahRFvbkscn2MlwGismPO12i9+znNruC5gVEntG3qu0xQMzsGg/JFbrsqDOHtHFPci+V5aP5T9I+yeKqw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/is-docker": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
- "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "is-docker": "cli.js"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/is-fullwidth-code-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/is-number": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
- "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.12.0"
- }
- },
- "node_modules/is-wsl": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
- "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "is-docker": "^2.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/istanbul-lib-coverage": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
- "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
- "license": "BSD-3-Clause",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/istanbul-lib-instrument": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz",
- "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==",
- "license": "BSD-3-Clause",
- "peer": true,
- "dependencies": {
- "@babel/core": "^7.12.3",
- "@babel/parser": "^7.14.7",
- "@istanbuljs/schema": "^0.1.2",
- "istanbul-lib-coverage": "^3.2.0",
- "semver": "^6.3.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/istanbul-lib-instrument/node_modules/semver": {
- "version": "6.3.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
- "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
- "license": "ISC",
- "peer": true,
- "bin": {
- "semver": "bin/semver.js"
- }
- },
- "node_modules/jest-environment-node": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz",
- "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/environment": "^29.7.0",
- "@jest/fake-timers": "^29.7.0",
- "@jest/types": "^29.6.3",
- "@types/node": "*",
- "jest-mock": "^29.7.0",
- "jest-util": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-get-type": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz",
- "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-haste-map": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz",
- "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3",
- "@types/graceful-fs": "^4.1.3",
- "@types/node": "*",
- "anymatch": "^3.0.3",
- "fb-watchman": "^2.0.0",
- "graceful-fs": "^4.2.9",
- "jest-regex-util": "^29.6.3",
- "jest-util": "^29.7.0",
- "jest-worker": "^29.7.0",
- "micromatch": "^4.0.4",
- "walker": "^1.0.8"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- },
- "optionalDependencies": {
- "fsevents": "^2.3.2"
- }
- },
- "node_modules/jest-message-util": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz",
- "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/code-frame": "^7.12.13",
- "@jest/types": "^29.6.3",
- "@types/stack-utils": "^2.0.0",
- "chalk": "^4.0.0",
- "graceful-fs": "^4.2.9",
- "micromatch": "^4.0.4",
- "pretty-format": "^29.7.0",
- "slash": "^3.0.0",
- "stack-utils": "^2.0.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-mock": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz",
- "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3",
- "@types/node": "*",
- "jest-util": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-regex-util": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz",
- "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-util": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
- "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3",
- "@types/node": "*",
- "chalk": "^4.0.0",
- "ci-info": "^3.2.0",
- "graceful-fs": "^4.2.9",
- "picomatch": "^2.2.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-validate": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz",
- "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/types": "^29.6.3",
- "camelcase": "^6.2.0",
- "chalk": "^4.0.0",
- "jest-get-type": "^29.6.3",
- "leven": "^3.1.0",
- "pretty-format": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-validate/node_modules/camelcase": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
- "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/jest-worker": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz",
- "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@types/node": "*",
- "jest-util": "^29.7.0",
- "merge-stream": "^2.0.0",
- "supports-color": "^8.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-worker/node_modules/supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/supports-color?sponsor=1"
- }
- },
- "node_modules/js-tokens": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/js-yaml": {
- "version": "3.14.1",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
- "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "argparse": "^1.0.7",
- "esprima": "^4.0.0"
- },
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
- },
- "node_modules/jsc-safe-url": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/jsc-safe-url/-/jsc-safe-url-0.2.4.tgz",
- "integrity": "sha512-0wM3YBWtYePOjfyXQH5MWQ8H7sdk5EXSwZvmSLKk2RboVQ2Bu239jycHDz5J/8Blf3K0Qnoy2b6xD+z10MFB+Q==",
- "license": "0BSD",
- "peer": true
- },
- "node_modules/jsesc": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
- "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "jsesc": "bin/jsesc"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/json-parse-better-errors": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
- "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/json5": {
- "version": "2.2.3",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
- "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "json5": "lib/cli.js"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/leven": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
- "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/lighthouse-logger": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.4.2.tgz",
- "integrity": "sha512-gPWxznF6TKmUHrOQjlVo2UbaL2EJ71mb2CCeRs/2qBpi4L/g4LUVc9+3lKQ6DTUZwJswfM7ainGrLO1+fOqa2g==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "debug": "^2.6.9",
- "marky": "^1.2.2"
- }
- },
- "node_modules/lighthouse-logger/node_modules/debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ms": "2.0.0"
- }
- },
- "node_modules/lighthouse-logger/node_modules/ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/locate-path": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "p-locate": "^4.1.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/lodash.throttle": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
- "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/loose-envify": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
- "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "js-tokens": "^3.0.0 || ^4.0.0"
- },
- "bin": {
- "loose-envify": "cli.js"
- }
- },
- "node_modules/lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "yallist": "^3.0.2"
- }
- },
- "node_modules/makeerror": {
- "version": "1.0.12",
- "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
- "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==",
- "license": "BSD-3-Clause",
- "peer": true,
- "dependencies": {
- "tmpl": "1.0.5"
- }
- },
- "node_modules/marky": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/marky/-/marky-1.3.0.tgz",
- "integrity": "sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==",
- "license": "Apache-2.0",
- "peer": true
- },
- "node_modules/math-intrinsics": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
- "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- }
- },
- "node_modules/memoize-one": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
- "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/merge-stream": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
- "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/metro": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro/-/metro-0.82.5.tgz",
- "integrity": "sha512-8oAXxL7do8QckID/WZEKaIFuQJFUTLzfVcC48ghkHhNK2RGuQq8Xvf4AVd+TUA0SZtX0q8TGNXZ/eba1ckeGCg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/code-frame": "^7.24.7",
- "@babel/core": "^7.25.2",
- "@babel/generator": "^7.25.0",
- "@babel/parser": "^7.25.3",
- "@babel/template": "^7.25.0",
- "@babel/traverse": "^7.25.3",
- "@babel/types": "^7.25.2",
- "accepts": "^1.3.7",
- "chalk": "^4.0.0",
- "ci-info": "^2.0.0",
- "connect": "^3.6.5",
- "debug": "^4.4.0",
- "error-stack-parser": "^2.0.6",
- "flow-enums-runtime": "^0.0.6",
- "graceful-fs": "^4.2.4",
- "hermes-parser": "0.29.1",
- "image-size": "^1.0.2",
- "invariant": "^2.2.4",
- "jest-worker": "^29.7.0",
- "jsc-safe-url": "^0.2.2",
- "lodash.throttle": "^4.1.1",
- "metro-babel-transformer": "0.82.5",
- "metro-cache": "0.82.5",
- "metro-cache-key": "0.82.5",
- "metro-config": "0.82.5",
- "metro-core": "0.82.5",
- "metro-file-map": "0.82.5",
- "metro-resolver": "0.82.5",
- "metro-runtime": "0.82.5",
- "metro-source-map": "0.82.5",
- "metro-symbolicate": "0.82.5",
- "metro-transform-plugins": "0.82.5",
- "metro-transform-worker": "0.82.5",
- "mime-types": "^2.1.27",
- "nullthrows": "^1.1.1",
- "serialize-error": "^2.1.0",
- "source-map": "^0.5.6",
- "throat": "^5.0.0",
- "ws": "^7.5.10",
- "yargs": "^17.6.2"
- },
- "bin": {
- "metro": "src/cli.js"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-babel-transformer": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-babel-transformer/-/metro-babel-transformer-0.82.5.tgz",
- "integrity": "sha512-W/scFDnwJXSccJYnOFdGiYr9srhbHPdxX9TvvACOFsIXdLilh3XuxQl/wXW6jEJfgIb0jTvoTlwwrqvuwymr6Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/core": "^7.25.2",
- "flow-enums-runtime": "^0.0.6",
- "hermes-parser": "0.29.1",
- "nullthrows": "^1.1.1"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-babel-transformer/node_modules/hermes-estree": {
- "version": "0.29.1",
- "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.29.1.tgz",
- "integrity": "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/metro-babel-transformer/node_modules/hermes-parser": {
- "version": "0.29.1",
- "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.29.1.tgz",
- "integrity": "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "hermes-estree": "0.29.1"
- }
- },
- "node_modules/metro-cache": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-cache/-/metro-cache-0.82.5.tgz",
- "integrity": "sha512-AwHV9607xZpedu1NQcjUkua8v7HfOTKfftl6Vc9OGr/jbpiJX6Gpy8E/V9jo/U9UuVYX2PqSUcVNZmu+LTm71Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "exponential-backoff": "^3.1.1",
- "flow-enums-runtime": "^0.0.6",
- "https-proxy-agent": "^7.0.5",
- "metro-core": "0.82.5"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-cache-key": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-cache-key/-/metro-cache-key-0.82.5.tgz",
- "integrity": "sha512-qpVmPbDJuRLrT4kcGlUouyqLGssJnbTllVtvIgXfR7ZuzMKf0mGS+8WzcqzNK8+kCyakombQWR0uDd8qhWGJcA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-config": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-config/-/metro-config-0.82.5.tgz",
- "integrity": "sha512-/r83VqE55l0WsBf8IhNmc/3z71y2zIPe5kRSuqA5tY/SL/ULzlHUJEMd1szztd0G45JozLwjvrhAzhDPJ/Qo/g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "connect": "^3.6.5",
- "cosmiconfig": "^5.0.5",
- "flow-enums-runtime": "^0.0.6",
- "jest-validate": "^29.7.0",
- "metro": "0.82.5",
- "metro-cache": "0.82.5",
- "metro-core": "0.82.5",
- "metro-runtime": "0.82.5"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-core": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-core/-/metro-core-0.82.5.tgz",
- "integrity": "sha512-OJL18VbSw2RgtBm1f2P3J5kb892LCVJqMvslXxuxjAPex8OH7Eb8RBfgEo7VZSjgb/LOf4jhC4UFk5l5tAOHHA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6",
- "lodash.throttle": "^4.1.1",
- "metro-resolver": "0.82.5"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-file-map": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-file-map/-/metro-file-map-0.82.5.tgz",
- "integrity": "sha512-vpMDxkGIB+MTN8Af5hvSAanc6zXQipsAUO+XUx3PCQieKUfLwdoa8qaZ1WAQYRpaU+CJ8vhBcxtzzo3d9IsCIQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "debug": "^4.4.0",
- "fb-watchman": "^2.0.0",
- "flow-enums-runtime": "^0.0.6",
- "graceful-fs": "^4.2.4",
- "invariant": "^2.2.4",
- "jest-worker": "^29.7.0",
- "micromatch": "^4.0.4",
- "nullthrows": "^1.1.1",
- "walker": "^1.0.7"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-minify-terser": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-minify-terser/-/metro-minify-terser-0.82.5.tgz",
- "integrity": "sha512-v6Nx7A4We6PqPu/ta1oGTqJ4Usz0P7c+3XNeBxW9kp8zayS3lHUKR0sY0wsCHInxZlNAEICx791x+uXytFUuwg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6",
- "terser": "^5.15.0"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-resolver": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-resolver/-/metro-resolver-0.82.5.tgz",
- "integrity": "sha512-kFowLnWACt3bEsuVsaRNgwplT8U7kETnaFHaZePlARz4Fg8tZtmRDUmjaD68CGAwc0rwdwNCkWizLYpnyVcs2g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-runtime": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-runtime/-/metro-runtime-0.82.5.tgz",
- "integrity": "sha512-rQZDoCUf7k4Broyw3Ixxlq5ieIPiR1ULONdpcYpbJQ6yQ5GGEyYjtkztGD+OhHlw81LCR2SUAoPvtTus2WDK5g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/runtime": "^7.25.0",
- "flow-enums-runtime": "^0.0.6"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-source-map": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-source-map/-/metro-source-map-0.82.5.tgz",
- "integrity": "sha512-wH+awTOQJVkbhn2SKyaw+0cd+RVSCZ3sHVgyqJFQXIee/yLs3dZqKjjeKKhhVeudgjXo7aE/vSu/zVfcQEcUfw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/traverse": "^7.25.3",
- "@babel/traverse--for-generate-function-map": "npm:@babel/traverse@^7.25.3",
- "@babel/types": "^7.25.2",
- "flow-enums-runtime": "^0.0.6",
- "invariant": "^2.2.4",
- "metro-symbolicate": "0.82.5",
- "nullthrows": "^1.1.1",
- "ob1": "0.82.5",
- "source-map": "^0.5.6",
- "vlq": "^1.0.0"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-symbolicate": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-symbolicate/-/metro-symbolicate-0.82.5.tgz",
- "integrity": "sha512-1u+07gzrvYDJ/oNXuOG1EXSvXZka/0JSW1q2EYBWerVKMOhvv9JzDGyzmuV7hHbF2Hg3T3S2uiM36sLz1qKsiw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6",
- "invariant": "^2.2.4",
- "metro-source-map": "0.82.5",
- "nullthrows": "^1.1.1",
- "source-map": "^0.5.6",
- "vlq": "^1.0.0"
- },
- "bin": {
- "metro-symbolicate": "src/index.js"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-transform-plugins": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-transform-plugins/-/metro-transform-plugins-0.82.5.tgz",
- "integrity": "sha512-57Bqf3rgq9nPqLrT2d9kf/2WVieTFqsQ6qWHpEng5naIUtc/Iiw9+0bfLLWSAw0GH40iJ4yMjFcFJDtNSYynMA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/core": "^7.25.2",
- "@babel/generator": "^7.25.0",
- "@babel/template": "^7.25.0",
- "@babel/traverse": "^7.25.3",
- "flow-enums-runtime": "^0.0.6",
- "nullthrows": "^1.1.1"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro-transform-worker": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/metro-transform-worker/-/metro-transform-worker-0.82.5.tgz",
- "integrity": "sha512-mx0grhAX7xe+XUQH6qoHHlWedI8fhSpDGsfga7CpkO9Lk9W+aPitNtJWNGrW8PfjKEWbT9Uz9O50dkI8bJqigw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@babel/core": "^7.25.2",
- "@babel/generator": "^7.25.0",
- "@babel/parser": "^7.25.3",
- "@babel/types": "^7.25.2",
- "flow-enums-runtime": "^0.0.6",
- "metro": "0.82.5",
- "metro-babel-transformer": "0.82.5",
- "metro-cache": "0.82.5",
- "metro-cache-key": "0.82.5",
- "metro-minify-terser": "0.82.5",
- "metro-source-map": "0.82.5",
- "metro-transform-plugins": "0.82.5",
- "nullthrows": "^1.1.1"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/metro/node_modules/ci-info": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
- "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/metro/node_modules/hermes-estree": {
- "version": "0.29.1",
- "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.29.1.tgz",
- "integrity": "sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/metro/node_modules/hermes-parser": {
- "version": "0.29.1",
- "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.29.1.tgz",
- "integrity": "sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "hermes-estree": "0.29.1"
- }
- },
- "node_modules/metro/node_modules/ws": {
- "version": "7.5.10",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
- "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8.3.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": "^5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
- "node_modules/micromatch": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
- },
- "engines": {
- "node": ">=8.6"
- }
- },
- "node_modules/mime": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "mime": "cli.js"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/mime-db": {
- "version": "1.52.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
- "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/mime-types": {
- "version": "2.1.35",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
- "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
- "license": "MIT",
- "dependencies": {
- "mime-db": "1.52.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "brace-expansion": "^1.1.7"
- },
- "engines": {
- "node": "*"
- }
- },
- "node_modules/mkdirp": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
- "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
- "license": "MIT",
- "peer": true,
- "bin": {
- "mkdirp": "bin/cmd.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/nanoid": {
- "version": "3.3.11",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
- "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "MIT",
- "bin": {
- "nanoid": "bin/nanoid.cjs"
- },
- "engines": {
- "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
- }
- },
- "node_modules/negotiator": {
- "version": "0.6.3",
- "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
- "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/node-int64": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
- "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/node-releases": {
- "version": "2.0.19",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz",
- "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/normalize-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
- "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/nullthrows": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz",
- "integrity": "sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/ob1": {
- "version": "0.82.5",
- "resolved": "https://registry.npmjs.org/ob1/-/ob1-0.82.5.tgz",
- "integrity": "sha512-QyQQ6e66f+Ut/qUVjEce0E/wux5nAGLXYZDn1jr15JWstHsCH3l6VVrg8NKDptW9NEiBXKOJeGF/ydxeSDF3IQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "flow-enums-runtime": "^0.0.6"
- },
- "engines": {
- "node": ">=18.18"
- }
- },
- "node_modules/on-finished": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
- "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ee-first": "1.1.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/once": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "wrappy": "1"
- }
- },
- "node_modules/open": {
- "version": "7.4.2",
- "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz",
- "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "is-docker": "^2.0.0",
- "is-wsl": "^2.1.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/p-limit": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "p-try": "^2.0.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/p-locate": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "p-limit": "^2.2.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/parse-json": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
- "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "error-ex": "^1.3.1",
- "json-parse-better-errors": "^1.0.1"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/parseurl": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
- "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/path-is-absolute": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
- "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/picocolors": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
- "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
- "node_modules/pirates": {
- "version": "4.0.7",
- "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
- "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/pretty-format": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
- "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/schemas": "^29.6.3",
- "ansi-styles": "^5.0.0",
- "react-is": "^18.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/pretty-format/node_modules/ansi-styles": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
- "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/pretty-format/node_modules/react-is": {
- "version": "18.3.1",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
- "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/promise": {
- "version": "8.3.0",
- "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz",
- "integrity": "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "asap": "~2.0.6"
- }
- },
- "node_modules/proxy-from-env": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
- "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
- "license": "MIT"
- },
- "node_modules/query-string": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz",
- "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==",
- "license": "MIT",
- "dependencies": {
- "decode-uri-component": "^0.2.2",
- "filter-obj": "^1.1.0",
- "split-on-first": "^1.0.0",
- "strict-uri-encode": "^2.0.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/queue": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
- "integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "inherits": "~2.0.3"
- }
- },
- "node_modules/range-parser": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
- "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/react": {
- "version": "19.1.1",
- "resolved": "https://registry.npmjs.org/react/-/react-19.1.1.tgz",
- "integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/react-devtools-core": {
- "version": "6.1.5",
- "resolved": "https://registry.npmjs.org/react-devtools-core/-/react-devtools-core-6.1.5.tgz",
- "integrity": "sha512-ePrwPfxAnB+7hgnEr8vpKxL9cmnp7F322t8oqcPshbIQQhDKgFDW4tjhF2wjVbdXF9O/nyuy3sQWd9JGpiLPvA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "shell-quote": "^1.6.1",
- "ws": "^7"
- }
- },
- "node_modules/react-devtools-core/node_modules/ws": {
- "version": "7.5.10",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
- "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8.3.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": "^5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
- "node_modules/react-freeze": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/react-freeze/-/react-freeze-1.0.4.tgz",
- "integrity": "sha512-r4F0Sec0BLxWicc7HEyo2x3/2icUTrRmDjaaRyzzn+7aDyFZliszMDOgLVwSnQnYENOlL1o569Ze2HZefk8clA==",
- "license": "MIT",
- "engines": {
- "node": ">=10"
- },
- "peerDependencies": {
- "react": ">=17.0.0"
- }
- },
- "node_modules/react-is": {
- "version": "19.1.1",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.1.1.tgz",
- "integrity": "sha512-tr41fA15Vn8p4X9ntI+yCyeGSf1TlYaY5vlTZfQmeLBrFo3psOPX6HhTDnFNL9uj3EhP0KAQ80cugCl4b4BERA==",
- "license": "MIT"
- },
- "node_modules/react-native": {
- "version": "0.80.2",
- "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.80.2.tgz",
- "integrity": "sha512-6ySV4qTJo/To3lgpG/9Mcg/ZtvExqOVZuT7JVGcO5rS2Bjvl/yUAkQF0hTnbRb2Ch6T5MlKghrM4OeHX+KA9Pg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@jest/create-cache-key-function": "^29.7.0",
- "@react-native/assets-registry": "0.80.2",
- "@react-native/codegen": "0.80.2",
- "@react-native/community-cli-plugin": "0.80.2",
- "@react-native/gradle-plugin": "0.80.2",
- "@react-native/js-polyfills": "0.80.2",
- "@react-native/normalize-colors": "0.80.2",
- "@react-native/virtualized-lists": "0.80.2",
- "abort-controller": "^3.0.0",
- "anser": "^1.4.9",
- "ansi-regex": "^5.0.0",
- "babel-jest": "^29.7.0",
- "babel-plugin-syntax-hermes-parser": "0.28.1",
- "base64-js": "^1.5.1",
- "chalk": "^4.0.0",
- "commander": "^12.0.0",
- "flow-enums-runtime": "^0.0.6",
- "glob": "^7.1.1",
- "invariant": "^2.2.4",
- "jest-environment-node": "^29.7.0",
- "memoize-one": "^5.0.0",
- "metro-runtime": "^0.82.2",
- "metro-source-map": "^0.82.2",
- "nullthrows": "^1.1.1",
- "pretty-format": "^29.7.0",
- "promise": "^8.3.0",
- "react-devtools-core": "^6.1.1",
- "react-refresh": "^0.14.0",
- "regenerator-runtime": "^0.13.2",
- "scheduler": "0.26.0",
- "semver": "^7.1.3",
- "stacktrace-parser": "^0.1.10",
- "whatwg-fetch": "^3.0.0",
- "ws": "^6.2.3",
- "yargs": "^17.6.2"
- },
- "bin": {
- "react-native": "cli.js"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "@types/react": "^19.1.0",
- "react": "^19.1.0"
- },
- "peerDependenciesMeta": {
- "@types/react": {
- "optional": true
- }
- }
- },
- "node_modules/react-native-is-edge-to-edge": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/react-native-is-edge-to-edge/-/react-native-is-edge-to-edge-1.2.1.tgz",
- "integrity": "sha512-FLbPWl/MyYQWz+KwqOZsSyj2JmLKglHatd3xLZWskXOpRaio4LfEDEz8E/A6uD8QoTHW6Aobw1jbEwK7KMgR7Q==",
- "license": "MIT",
- "peerDependencies": {
- "react": "*",
- "react-native": "*"
- }
- },
- "node_modules/react-native-paper": {
- "version": "5.14.5",
- "resolved": "https://registry.npmjs.org/react-native-paper/-/react-native-paper-5.14.5.tgz",
- "integrity": "sha512-eaIH5bUQjJ/mYm4AkI6caaiyc7BcHDwX6CqNDi6RIxfxfWxROsHpll1oBuwn/cFvknvA8uEAkqLk/vzVihI3AQ==",
- "license": "MIT",
- "workspaces": [
- "example",
- "docs"
- ],
- "dependencies": {
- "@callstack/react-theme-provider": "^3.0.9",
- "color": "^3.1.2",
- "use-latest-callback": "^0.2.3"
- },
- "peerDependencies": {
- "react": "*",
- "react-native": "*",
- "react-native-safe-area-context": "*"
- }
- },
- "node_modules/react-native-paper/node_modules/color": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
- "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^1.9.3",
- "color-string": "^1.6.0"
- }
- },
- "node_modules/react-native-paper/node_modules/color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
- "license": "MIT",
- "dependencies": {
- "color-name": "1.1.3"
- }
- },
- "node_modules/react-native-paper/node_modules/color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
- "license": "MIT"
- },
- "node_modules/react-native-safe-area-context": {
- "version": "5.5.2",
- "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.5.2.tgz",
- "integrity": "sha512-t4YVbHa9uAGf+pHMabGrb0uHrD5ogAusSu842oikJ3YKXcYp6iB4PTGl0EZNkUIR3pCnw/CXKn42OCfhsS0JIw==",
- "license": "MIT",
- "peerDependencies": {
- "react": "*",
- "react-native": "*"
- }
- },
- "node_modules/react-native-screens": {
- "version": "4.13.1",
- "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-4.13.1.tgz",
- "integrity": "sha512-EESsMAtyzYcL3gpAI2NKKiIo+Ew0fnX4P4b3Zy/+MTc6SJIo3foJbZwdIWd/SUBswOf7IYCvWBppg+D8tbwnsw==",
- "license": "MIT",
- "dependencies": {
- "react-freeze": "^1.0.0",
- "react-native-is-edge-to-edge": "^1.2.1",
- "warn-once": "^0.1.0"
- },
- "peerDependencies": {
- "react": "*",
- "react-native": "*"
- }
- },
- "node_modules/react-refresh": {
- "version": "0.14.2",
- "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
- "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/regenerator-runtime": {
- "version": "0.13.11",
- "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
- "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/require-directory": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
- "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/resolve-from": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
- "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "glob": "^7.1.3"
- },
- "bin": {
- "rimraf": "bin.js"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/scheduler": {
- "version": "0.26.0",
- "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",
- "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/semver": {
- "version": "7.7.2",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
- "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
- "license": "ISC",
- "peer": true,
- "bin": {
- "semver": "bin/semver.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/send": {
- "version": "0.19.0",
- "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
- "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "debug": "2.6.9",
- "depd": "2.0.0",
- "destroy": "1.2.0",
- "encodeurl": "~1.0.2",
- "escape-html": "~1.0.3",
- "etag": "~1.8.1",
- "fresh": "0.5.2",
- "http-errors": "2.0.0",
- "mime": "1.6.0",
- "ms": "2.1.3",
- "on-finished": "2.4.1",
- "range-parser": "~1.2.1",
- "statuses": "2.0.1"
- },
- "engines": {
- "node": ">= 0.8.0"
- }
- },
- "node_modules/send/node_modules/debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ms": "2.0.0"
- }
- },
- "node_modules/send/node_modules/debug/node_modules/ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/send/node_modules/on-finished": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
- "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ee-first": "1.1.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/send/node_modules/statuses": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
- "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/serialize-error": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
- "integrity": "sha512-ghgmKt5o4Tly5yEG/UJp8qTd0AN7Xalw4XBtDEKP655B699qMEtra1WlXeE6WIvdEG481JvRxULKsInq/iNysw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/serve-static": {
- "version": "1.16.2",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
- "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "encodeurl": "~2.0.0",
- "escape-html": "~1.0.3",
- "parseurl": "~1.3.3",
- "send": "0.19.0"
- },
- "engines": {
- "node": ">= 0.8.0"
- }
- },
- "node_modules/serve-static/node_modules/encodeurl": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
- "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/setprototypeof": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
- "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/shell-quote": {
- "version": "1.8.3",
- "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",
- "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/signal-exit": {
- "version": "3.0.7",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
- "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/simple-swizzle": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
- "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
- "license": "MIT",
- "dependencies": {
- "is-arrayish": "^0.3.1"
- }
- },
- "node_modules/simple-swizzle/node_modules/is-arrayish": {
- "version": "0.3.2",
- "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
- "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
- "license": "MIT"
- },
- "node_modules/slash": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
- "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/source-map": {
- "version": "0.5.7",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
- "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
- "license": "BSD-3-Clause",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/source-map-support": {
- "version": "0.5.21",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
- "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "buffer-from": "^1.0.0",
- "source-map": "^0.6.0"
- }
- },
- "node_modules/source-map-support/node_modules/source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
- "license": "BSD-3-Clause",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/split-on-first": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz",
- "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/sprintf-js": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
- "license": "BSD-3-Clause",
- "peer": true
- },
- "node_modules/stack-utils": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz",
- "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "escape-string-regexp": "^2.0.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/stack-utils/node_modules/escape-string-regexp": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
- "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/stackframe": {
- "version": "1.3.4",
- "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz",
- "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/stacktrace-parser": {
- "version": "0.1.11",
- "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz",
- "integrity": "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "type-fest": "^0.7.1"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/statuses": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
- "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/strict-uri-encode": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
- "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==",
- "license": "MIT",
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/string-width": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/strip-ansi": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ansi-regex": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/terser": {
- "version": "5.43.1",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
- "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
- "license": "BSD-2-Clause",
- "peer": true,
- "dependencies": {
- "@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.14.0",
- "commander": "^2.20.0",
- "source-map-support": "~0.5.20"
- },
- "bin": {
- "terser": "bin/terser"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/terser/node_modules/commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/test-exclude": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
- "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "@istanbuljs/schema": "^0.1.2",
- "glob": "^7.1.4",
- "minimatch": "^3.0.4"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/throat": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz",
- "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/tmpl": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
- "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
- "license": "BSD-3-Clause",
- "peer": true
- },
- "node_modules/to-regex-range": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
- "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "is-number": "^7.0.0"
- },
- "engines": {
- "node": ">=8.0"
- }
- },
- "node_modules/toidentifier": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
- "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.6"
- }
- },
- "node_modules/type-detect": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
- "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/type-fest": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz",
- "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==",
- "license": "(MIT OR CC0-1.0)",
- "peer": true,
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/undici-types": {
- "version": "7.8.0",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
- "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/unpipe": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
- "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/update-browserslist-db": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
- "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/browserslist"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "escalade": "^3.2.0",
- "picocolors": "^1.1.1"
- },
- "bin": {
- "update-browserslist-db": "cli.js"
- },
- "peerDependencies": {
- "browserslist": ">= 4.21.0"
- }
- },
- "node_modules/use-latest-callback": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/use-latest-callback/-/use-latest-callback-0.2.4.tgz",
- "integrity": "sha512-LS2s2n1usUUnDq4oVh1ca6JFX9uSqUncTfAm44WMg0v6TxL7POUTk1B044NH8TeLkFbNajIsgDHcgNpNzZucdg==",
- "license": "MIT",
- "peerDependencies": {
- "react": ">=16.8"
- }
- },
- "node_modules/use-sync-external-store": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz",
- "integrity": "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==",
- "license": "MIT",
- "peerDependencies": {
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
- }
- },
- "node_modules/utils-merge": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
- "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 0.4.0"
- }
- },
- "node_modules/vlq": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz",
- "integrity": "sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/walker": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz",
- "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "makeerror": "1.0.12"
- }
- },
- "node_modules/warn-once": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/warn-once/-/warn-once-0.1.1.tgz",
- "integrity": "sha512-VkQZJbO8zVImzYFteBXvBOZEl1qL175WH8VmZcxF2fZAoudNhNDvHi+doCaAEdU2l2vtcIwa2zn0QK5+I1HQ3Q==",
- "license": "MIT"
- },
- "node_modules/whatwg-fetch": {
- "version": "3.6.20",
- "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz",
- "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/wrap-ansi": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
- }
- },
- "node_modules/wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/write-file-atomic": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz",
- "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "imurmurhash": "^0.1.4",
- "signal-exit": "^3.0.7"
- },
- "engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
- }
- },
- "node_modules/ws": {
- "version": "6.2.3",
- "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz",
- "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "async-limiter": "~1.0.0"
- }
- },
- "node_modules/y18n": {
- "version": "5.0.8",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
- "license": "ISC",
- "peer": true,
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "license": "ISC",
- "peer": true
- },
- "node_modules/yargs": {
- "version": "17.7.2",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
- "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "cliui": "^8.0.1",
- "escalade": "^3.1.1",
- "get-caller-file": "^2.0.5",
- "require-directory": "^2.1.1",
- "string-width": "^4.2.3",
- "y18n": "^5.0.5",
- "yargs-parser": "^21.1.1"
- },
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/yargs-parser": {
- "version": "21.1.1",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
- "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
- "license": "ISC",
- "peer": true,
- "engines": {
- "node": ">=12"
- }
- }
- }
-}
diff --git a/frontend/frontend/package.json b/frontend/frontend/package.json
deleted file mode 100644
index 768cfeb4..00000000
--- a/frontend/frontend/package.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "dependencies": {
- "@react-navigation/native": "^7.1.16",
- "@react-navigation/native-stack": "^7.3.23",
- "axios": "^1.11.0",
- "react-native-paper": "^5.14.5",
- "react-native-safe-area-context": "^5.5.2",
- "react-native-screens": "^4.13.1"
- }
-}
From df450737195a378b806b9924c14e90d120707610 Mon Sep 17 00:00:00 2001
From: "coderabbitai[bot]"
<136622811+coderabbitai[bot]@users.noreply.github.com>
Date: Sat, 2 Aug 2025 18:15:11 +0000
Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=9D=20CodeRabbit=20Chat:=20Add=20c?=
=?UTF-8?q?omprehensive=20Jest=20unit=20tests=20for=20API,=20utils,=20and?=
=?UTF-8?q?=20screen=20components?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/api/groups.test.js | 901 ++++++++++++++++
frontend/babel.config.js | 13 +
frontend/jest.setup.js | 26 +
frontend/package.json | 36 +-
frontend/screens/FriendsScreen.test.js | 597 ++++++++++
frontend/screens/GroupDetailsScreen.test.js | 1078 +++++++++++++++++++
frontend/screens/HomeScreen.js | 4 +-
frontend/screens/HomeScreen.test.js | 851 +++++++++++++++
frontend/utils/balanceCalculator.test.js | 815 ++++++++++++++
9 files changed, 4316 insertions(+), 5 deletions(-)
create mode 100644 frontend/api/groups.test.js
create mode 100644 frontend/babel.config.js
create mode 100644 frontend/jest.setup.js
create mode 100644 frontend/screens/FriendsScreen.test.js
create mode 100644 frontend/screens/GroupDetailsScreen.test.js
create mode 100644 frontend/screens/HomeScreen.test.js
create mode 100644 frontend/utils/balanceCalculator.test.js
diff --git a/frontend/api/groups.test.js b/frontend/api/groups.test.js
new file mode 100644
index 00000000..da4c48e3
--- /dev/null
+++ b/frontend/api/groups.test.js
@@ -0,0 +1,901 @@
+import axios from 'axios';
+import {
+ getGroups,
+ getOptimizedSettlements,
+ createExpense,
+ getGroupDetails,
+ getGroupMembers,
+ getGroupExpenses,
+ createGroup,
+ joinGroup,
+ getUserBalanceSummary,
+ getFriendsBalance
+} from './groups';
+
+// Mock axios
+jest.mock('axios');
+const mockedAxios = axios;
+
+describe('Groups API', () => {
+ let mockApiClient;
+
+ beforeEach(() => {
+ // Reset all mocks before each test
+ jest.clearAllMocks();
+
+ // Create a mock API client
+ mockApiClient = {
+ get: jest.fn(),
+ post: jest.fn()
+ };
+
+ // Mock axios.create to return our mock client
+ mockedAxios.create.mockReturnValue(mockApiClient);
+ });
+
+ describe('API Client Configuration', () => {
+ test('should create axios instance with correct base URL and headers', () => {
+ // Import the module to trigger axios.create
+ require('./groups');
+
+ expect(mockedAxios.create).toHaveBeenCalledWith({
+ baseURL: 'https://splitwiser-production.up.railway.app',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+ });
+ });
+
+ describe('getGroups', () => {
+ test('should fetch groups with valid token', async () => {
+ const mockToken = 'valid-token-123';
+ const mockResponse = { data: [{ id: 1, name: 'Test Group' }] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ });
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle empty token', async () => {
+ const mockToken = '';
+ const mockResponse = { data: [] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: 'Bearer ',
+ },
+ });
+ });
+
+ test('should handle null token', async () => {
+ const mockToken = null;
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: 'Bearer null',
+ },
+ });
+ });
+
+ test('should handle undefined token', async () => {
+ const mockToken = undefined;
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: 'Bearer undefined',
+ },
+ });
+ });
+
+ test('should handle API error', async () => {
+ const mockToken = 'valid-token';
+ const mockError = new Error('Network Error');
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toThrow('Network Error');
+ });
+
+ test('should handle 401 unauthorized error', async () => {
+ const mockToken = 'invalid-token';
+ const mockError = { response: { status: 401, data: { message: 'Unauthorized' } } };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toEqual(mockError);
+ });
+ });
+
+ describe('getOptimizedSettlements', () => {
+ test('should fetch optimized settlements with valid parameters', async () => {
+ const mockToken = 'valid-token-123';
+ const mockGroupId = 'group-123';
+ const mockResponse = { data: { settlements: [] } };
+ mockApiClient.post.mockResolvedValue(mockResponse);
+
+ const result = await getOptimizedSettlements(mockToken, mockGroupId);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/settlements/optimize`,
+ {},
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle numeric group ID', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 123;
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await getOptimizedSettlements(mockToken, mockGroupId);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups/123/settlements/optimize',
+ {},
+ expect.any(Object)
+ );
+ });
+
+ test('should handle special characters in group ID', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-with-special-chars@#$';
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await getOptimizedSettlements(mockToken, mockGroupId);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups/group-with-special-chars@#$/settlements/optimize',
+ {},
+ expect.any(Object)
+ );
+ });
+
+ test('should handle API error for settlements', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockError = new Error('Settlement calculation failed');
+ mockApiClient.post.mockRejectedValue(mockError);
+
+ await expect(getOptimizedSettlements(mockToken, mockGroupId)).rejects.toThrow(
+ 'Settlement calculation failed'
+ );
+ });
+ });
+
+ describe('createExpense', () => {
+ test('should create expense with valid data', async () => {
+ const mockToken = 'valid-token-123';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = {
+ description: 'Dinner',
+ amount: 50.25,
+ paidBy: 'user-123',
+ splitBetween: ['user-123', 'user-456']
+ };
+ const mockResponse = { data: { id: 'expense-123', ...mockExpenseData } };
+ mockApiClient.post.mockResolvedValue(mockResponse);
+
+ const result = await createExpense(mockToken, mockGroupId, mockExpenseData);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/expenses`,
+ mockExpenseData,
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle empty expense data', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = {};
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createExpense(mockToken, mockGroupId, mockExpenseData);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/expenses`,
+ {},
+ expect.any(Object)
+ );
+ });
+
+ test('should handle null expense data', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = null;
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createExpense(mockToken, mockGroupId, mockExpenseData);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/expenses`,
+ null,
+ expect.any(Object)
+ );
+ });
+
+ test('should handle large expense amounts', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = { amount: 999999.99 };
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createExpense(mockToken, mockGroupId, mockExpenseData);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ expect.any(String),
+ mockExpenseData,
+ expect.any(Object)
+ );
+ });
+
+ test('should handle negative expense amounts', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = { amount: -50.00 };
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createExpense(mockToken, mockGroupId, mockExpenseData);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ expect.any(String),
+ mockExpenseData,
+ expect.any(Object)
+ );
+ });
+ });
+
+ describe('getGroupDetails', () => {
+ test('should fetch both group members and expenses', async () => {
+ const mockToken = 'valid-token-123';
+ const mockGroupId = 'group-123';
+ const mockMembersResponse = { data: [{ id: 'user-1', name: 'John' }] };
+ const mockExpensesResponse = { data: [{ id: 'expense-1', amount: 50 }] };
+
+ mockApiClient.get
+ .mockResolvedValueOnce(mockMembersResponse)
+ .mockResolvedValueOnce(mockExpensesResponse);
+
+ const result = await getGroupDetails(mockToken, mockGroupId);
+
+ expect(result).toEqual([mockMembersResponse, mockExpensesResponse]);
+ expect(mockApiClient.get).toHaveBeenCalledTimes(2);
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/members`,
+ expect.any(Object)
+ );
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/expenses`,
+ expect.any(Object)
+ );
+ });
+
+ test('should handle when one API call fails', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockMembersResponse = { data: [] };
+ const mockError = new Error('Expenses fetch failed');
+
+ mockApiClient.get
+ .mockResolvedValueOnce(mockMembersResponse)
+ .mockRejectedValueOnce(mockError);
+
+ await expect(getGroupDetails(mockToken, mockGroupId)).rejects.toThrow(
+ 'Expenses fetch failed'
+ );
+ });
+
+ test('should handle when both API calls fail', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+ const mockError1 = new Error('Members fetch failed');
+ const mockError2 = new Error('Expenses fetch failed');
+
+ mockApiClient.get
+ .mockRejectedValueOnce(mockError1)
+ .mockRejectedValueOnce(mockError2);
+
+ await expect(getGroupDetails(mockToken, mockGroupId)).rejects.toThrow(
+ 'Members fetch failed'
+ );
+ });
+ });
+
+ describe('getGroupMembers', () => {
+ test('should fetch group members with valid parameters', async () => {
+ const mockToken = 'valid-token-123';
+ const mockGroupId = 'group-123';
+ const mockResponse = { data: [{ id: 'user-1', name: 'John Doe' }] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroupMembers(mockToken, mockGroupId);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/members`,
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle empty members list', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'empty-group';
+ const mockResponse = { data: [] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroupMembers(mockToken, mockGroupId);
+
+ expect(result.data).toEqual([]);
+ });
+ });
+
+ describe('getGroupExpenses', () => {
+ test('should fetch group expenses with valid parameters', async () => {
+ const mockToken = 'valid-token-123';
+ const mockGroupId = 'group-123';
+ const mockResponse = {
+ data: [
+ { id: 'expense-1', description: 'Lunch', amount: 25.50 },
+ { id: 'expense-2', description: 'Dinner', amount: 40.00 }
+ ]
+ };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroupExpenses(mockToken, mockGroupId);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ `/groups/${mockGroupId}/expenses`,
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle group with no expenses', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'new-group';
+ const mockResponse = { data: [] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroupExpenses(mockToken, mockGroupId);
+
+ expect(result.data).toEqual([]);
+ });
+ });
+
+ describe('createGroup', () => {
+ test('should create group with valid name', async () => {
+ const mockToken = 'valid-token-123';
+ const mockName = 'My Awesome Group';
+ const mockResponse = { data: { id: 'group-123', name: mockName } };
+ mockApiClient.post.mockResolvedValue(mockResponse);
+
+ const result = await createGroup(mockToken, mockName);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups',
+ { name: mockName },
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle empty group name', async () => {
+ const mockToken = 'valid-token';
+ const mockName = '';
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createGroup(mockToken, mockName);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups',
+ { name: '' },
+ expect.any(Object)
+ );
+ });
+
+ test('should handle very long group name', async () => {
+ const mockToken = 'valid-token';
+ const mockName = 'A'.repeat(1000);
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createGroup(mockToken, mockName);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups',
+ { name: mockName },
+ expect.any(Object)
+ );
+ });
+
+ test('should handle special characters in group name', async () => {
+ const mockToken = 'valid-token';
+ const mockName = 'Group @#$%^&*()_+-={}[]|\\:";\'<>?,./';
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createGroup(mockToken, mockName);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups',
+ { name: mockName },
+ expect.any(Object)
+ );
+ });
+
+ test('should handle unicode characters in group name', async () => {
+ const mockToken = 'valid-token';
+ const mockName = '🎉 Party Group 🎊';
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await createGroup(mockToken, mockName);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups',
+ { name: mockName },
+ expect.any(Object)
+ );
+ });
+ });
+
+ describe('joinGroup', () => {
+ test('should join group with valid join code', async () => {
+ const mockToken = 'valid-token-123';
+ const mockJoinCode = 'ABC123XYZ';
+ const mockResponse = { data: { groupId: 'group-123', message: 'Joined successfully' } };
+ mockApiClient.post.mockResolvedValue(mockResponse);
+
+ const result = await joinGroup(mockToken, mockJoinCode);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups/join',
+ { joinCode: mockJoinCode },
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle invalid join code', async () => {
+ const mockToken = 'valid-token';
+ const mockJoinCode = 'INVALID';
+ const mockError = { response: { status: 404, data: { message: 'Group not found' } } };
+ mockApiClient.post.mockRejectedValue(mockError);
+
+ await expect(joinGroup(mockToken, mockJoinCode)).rejects.toEqual(mockError);
+ });
+
+ test('should handle empty join code', async () => {
+ const mockToken = 'valid-token';
+ const mockJoinCode = '';
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await joinGroup(mockToken, mockJoinCode);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups/join',
+ { joinCode: '' },
+ expect.any(Object)
+ );
+ });
+
+ test('should handle null join code', async () => {
+ const mockToken = 'valid-token';
+ const mockJoinCode = null;
+ mockApiClient.post.mockResolvedValue({ data: {} });
+
+ await joinGroup(mockToken, mockJoinCode);
+
+ expect(mockApiClient.post).toHaveBeenCalledWith(
+ '/groups/join',
+ { joinCode: null },
+ expect.any(Object)
+ );
+ });
+
+ test('should handle expired join code', async () => {
+ const mockToken = 'valid-token';
+ const mockJoinCode = 'EXPIRED123';
+ const mockError = { response: { status: 410, data: { message: 'Join code expired' } } };
+ mockApiClient.post.mockRejectedValue(mockError);
+
+ await expect(joinGroup(mockToken, mockJoinCode)).rejects.toEqual(mockError);
+ });
+ });
+
+ describe('getUserBalanceSummary', () => {
+ test('should fetch user balance summary with valid token', async () => {
+ const mockToken = 'valid-token-123';
+ const mockResponse = {
+ data: {
+ totalOwed: 150.75,
+ totalOwing: 75.25,
+ netBalance: 75.50
+ }
+ };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getUserBalanceSummary(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ '/users/me/balance-summary',
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle user with no balance data', async () => {
+ const mockToken = 'valid-token';
+ const mockResponse = {
+ data: {
+ totalOwed: 0,
+ totalOwing: 0,
+ netBalance: 0
+ }
+ };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getUserBalanceSummary(mockToken);
+
+ expect(result.data.netBalance).toBe(0);
+ });
+
+ test('should handle API error for balance summary', async () => {
+ const mockToken = 'valid-token';
+ const mockError = new Error('Balance calculation error');
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getUserBalanceSummary(mockToken)).rejects.toThrow(
+ 'Balance calculation error'
+ );
+ });
+ });
+
+ describe('getFriendsBalance', () => {
+ test('should fetch friends balance with valid token', async () => {
+ const mockToken = 'valid-token-123';
+ const mockResponse = {
+ data: [
+ { friendId: 'user-456', name: 'Alice', balance: 25.50 },
+ { friendId: 'user-789', name: 'Bob', balance: -15.25 }
+ ]
+ };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getFriendsBalance(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ '/users/me/friends-balance',
+ {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ }
+ );
+ expect(result).toBe(mockResponse);
+ });
+
+ test('should handle user with no friends', async () => {
+ const mockToken = 'valid-token';
+ const mockResponse = { data: [] };
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getFriendsBalance(mockToken);
+
+ expect(result.data).toEqual([]);
+ });
+
+ test('should handle API error for friends balance', async () => {
+ const mockToken = 'valid-token';
+ const mockError = { response: { status: 500, data: { message: 'Internal server error' } } };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getFriendsBalance(mockToken)).rejects.toEqual(mockError);
+ });
+ });
+
+ describe('Error Handling', () => {
+ test('should handle network timeouts', async () => {
+ const mockToken = 'valid-token';
+ const mockError = { code: 'ECONNABORTED', message: 'timeout of 5000ms exceeded' };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toEqual(mockError);
+ });
+
+ test('should handle connection refused', async () => {
+ const mockToken = 'valid-token';
+ const mockError = { code: 'ECONNREFUSED', message: 'connect ECONNREFUSED' };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toEqual(mockError);
+ });
+
+ test('should handle 500 internal server error', async () => {
+ const mockToken = 'valid-token';
+ const mockError = {
+ response: {
+ status: 500,
+ data: { message: 'Internal Server Error' }
+ }
+ };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toEqual(mockError);
+ });
+
+ test('should handle 403 forbidden error', async () => {
+ const mockToken = 'valid-token';
+ const mockError = {
+ response: {
+ status: 403,
+ data: { message: 'Forbidden' }
+ }
+ };
+ mockApiClient.get.mockRejectedValue(mockError);
+
+ await expect(getGroups(mockToken)).rejects.toEqual(mockError);
+ });
+
+ test('should handle malformed response', async () => {
+ const mockToken = 'valid-token';
+ const mockResponse = 'not json';
+ mockApiClient.get.mockResolvedValue(mockResponse);
+
+ const result = await getGroups(mockToken);
+
+ expect(result).toBe(mockResponse);
+ });
+ });
+
+ describe('Edge Cases', () => {
+ test('should handle very long tokens', async () => {
+ const mockToken = 'a'.repeat(10000);
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ });
+ });
+
+ test('should handle tokens with special characters', async () => {
+ const mockToken = 'token@#$%^&*()_+-={}[]|\\:";\'<>?,./';
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ });
+ });
+
+ test('should handle tokens with unicode characters', async () => {
+ const mockToken = 'token🎉🎊';
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroups(mockToken);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
+ headers: {
+ Authorization: `Bearer ${mockToken}`,
+ },
+ });
+ });
+
+ test('should handle boolean values as group IDs', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = true;
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroupMembers(mockToken, mockGroupId);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ '/groups/true/members',
+ expect.any(Object)
+ );
+ });
+
+ test('should handle object as group ID', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = { id: 123 };
+ mockApiClient.get.mockResolvedValue({ data: [] });
+
+ await getGroupMembers(mockToken, mockGroupId);
+
+ expect(mockApiClient.get).toHaveBeenCalledWith(
+ '/groups/[object Object]/members',
+ expect.any(Object)
+ );
+ });
+ });
+
+ describe('Concurrent Requests', () => {
+ test('should handle multiple concurrent getGroups calls', async () => {
+ const mockToken = 'valid-token';
+ const mockResponse1 = { data: [{ id: 1, name: 'Group 1' }] };
+ const mockResponse2 = { data: [{ id: 2, name: 'Group 2' }] };
+
+ mockApiClient.get
+ .mockResolvedValueOnce(mockResponse1)
+ .mockResolvedValueOnce(mockResponse2);
+
+ const [result1, result2] = await Promise.all([
+ getGroups(mockToken),
+ getGroups(mockToken)
+ ]);
+
+ expect(result1).toBe(mockResponse1);
+ expect(result2).toBe(mockResponse2);
+ expect(mockApiClient.get).toHaveBeenCalledTimes(2);
+ });
+
+ test('should handle mixed successful and failed concurrent requests', async () => {
+ const mockToken = 'valid-token';
+ const mockResponse = { data: [] };
+ const mockError = new Error('Failed request');
+
+ mockApiClient.get
+ .mockResolvedValueOnce(mockResponse)
+ .mockRejectedValueOnce(mockError);
+
+ const results = await Promise.allSettled([
+ getGroups(mockToken),
+ getGroups(mockToken)
+ ]);
+
+ expect(results[0].status).toBe('fulfilled');
+ expect(results[0].value).toBe(mockResponse);
+ expect(results[1].status).toBe('rejected');
+ expect(results[1].reason).toBe(mockError);
+ });
+ });
+
+ describe('Integration Tests', () => {
+ test('should handle complete group workflow', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupName = 'Test Group';
+ const mockGroupId = 'group-123';
+ const mockExpenseData = { description: 'Test expense', amount: 100 };
+
+ // Mock responses for the complete workflow
+ const createGroupResponse = { data: { id: mockGroupId, name: mockGroupName } };
+ const getMembersResponse = { data: [{ id: 'user-1', name: 'User 1' }] };
+ const getExpensesResponse = { data: [] };
+ const createExpenseResponse = { data: { id: 'expense-1', ...mockExpenseData } };
+
+ mockApiClient.post
+ .mockResolvedValueOnce(createGroupResponse) // createGroup
+ .mockResolvedValueOnce(createExpenseResponse); // createExpense
+
+ mockApiClient.get
+ .mockResolvedValueOnce(getMembersResponse) // getGroupMembers
+ .mockResolvedValueOnce(getExpensesResponse); // getGroupExpenses
+
+ // Execute workflow
+ const groupResult = await createGroup(mockToken, mockGroupName);
+ expect(groupResult).toBe(createGroupResponse);
+
+ const detailsResult = await getGroupDetails(mockToken, mockGroupId);
+ expect(detailsResult).toEqual([getMembersResponse, getExpensesResponse]);
+
+ const expenseResult = await createExpense(mockToken, mockGroupId, mockExpenseData);
+ expect(expenseResult).toBe(createExpenseResponse);
+ });
+
+ test('should handle authentication flow with all endpoints', async () => {
+ const mockToken = 'auth-token-123';
+
+ // Mock responses for all authenticated endpoints
+ mockApiClient.get
+ .mockResolvedValueOnce({ data: [] }) // getGroups
+ .mockResolvedValueOnce({ data: { totalOwed: 0, totalOwing: 0, netBalance: 0 } }) // getUserBalanceSummary
+ .mockResolvedValueOnce({ data: [] }); // getFriendsBalance
+
+ // Test all authenticated endpoints
+ await getGroups(mockToken);
+ await getUserBalanceSummary(mockToken);
+ await getFriendsBalance(mockToken);
+
+ // Verify all calls used the same token
+ expect(mockApiClient.get).toHaveBeenCalledTimes(3);
+ mockApiClient.get.mock.calls.forEach(call => {
+ expect(call[1].headers.Authorization).toBe(`Bearer ${mockToken}`);
+ });
+ });
+ });
+
+ describe('Performance Tests', () => {
+ test('should handle rapid sequential API calls', async () => {
+ const mockToken = 'valid-token';
+ const numCalls = 10;
+
+ // Mock responses for all calls
+ for (let i = 0; i < numCalls; i++) {
+ mockApiClient.get.mockResolvedValueOnce({ data: [`group-${i}`] });
+ }
+
+ // Make rapid sequential calls
+ const promises = [];
+ for (let i = 0; i < numCalls; i++) {
+ promises.push(getGroups(mockToken));
+ }
+
+ const results = await Promise.all(promises);
+
+ expect(results).toHaveLength(numCalls);
+ expect(mockApiClient.get).toHaveBeenCalledTimes(numCalls);
+ });
+
+ test('should maintain correct call order with mixed async operations', async () => {
+ const mockToken = 'valid-token';
+ const mockGroupId = 'group-123';
+
+ // Mock different response times by using different delays
+ mockApiClient.get
+ .mockImplementationOnce(() => new Promise(resolve =>
+ setTimeout(() => resolve({ data: 'first' }), 100)))
+ .mockImplementationOnce(() => new Promise(resolve =>
+ setTimeout(() => resolve({ data: 'second' }), 50)))
+ .mockImplementationOnce(() => new Promise(resolve =>
+ setTimeout(() => resolve({ data: 'third' }), 25)));
+
+ const [first, second, third] = await Promise.all([
+ getGroups(mockToken),
+ getGroupMembers(mockToken, mockGroupId),
+ getGroupExpenses(mockToken, mockGroupId)
+ ]);
+
+ // Results should match the order of calls, not completion order
+ expect(first.data).toBe('first');
+ expect(second.data).toBe('second');
+ expect(third.data).toBe('third');
+ });
+ });
+});
\ No newline at end of file
diff --git a/frontend/babel.config.js b/frontend/babel.config.js
new file mode 100644
index 00000000..ec9bc813
--- /dev/null
+++ b/frontend/babel.config.js
@@ -0,0 +1,13 @@
+module.exports = function(api) {
+ api.cache(true);
+ return {
+ presets: ['babel-preset-expo'],
+ plugins: [
+ ['module-resolver', {
+ alias: {
+ '@': './src',
+ },
+ }],
+ ],
+ };
+};
\ No newline at end of file
diff --git a/frontend/jest.setup.js b/frontend/jest.setup.js
new file mode 100644
index 00000000..73951f78
--- /dev/null
+++ b/frontend/jest.setup.js
@@ -0,0 +1,26 @@
+// Jest setup file for additional configuration
+import 'react-native-gesture-handler/jestSetup';
+
+// Mock react-native modules that might cause issues in testing
+jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
+
+// Mock AsyncStorage
+jest.mock('@react-native-async-storage/async-storage', () =>
+ require('@react-native-async-storage/async-storage/jest/async-storage-mock')
+);
+
+// Mock react-navigation
+jest.mock('@react-navigation/native', () => {
+ return {
+ useNavigation: () => ({
+ navigate: jest.fn(),
+ goBack: jest.fn(),
+ }),
+ useRoute: () => ({
+ params: {},
+ }),
+ };
+});
+
+// Global test timeout
+jest.setTimeout(10000);
\ No newline at end of file
diff --git a/frontend/package.json b/frontend/package.json
index 3e33c375..95bc3656 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -6,7 +6,10 @@
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
- "web": "expo start --web"
+ "web": "expo start --web",
+ "test": "jest",
+ "test:watch": "jest --watch",
+ "test:coverage": "jest --coverage"
},
"dependencies": {
"@expo/metro-runtime": "~5.0.4",
@@ -26,7 +29,34 @@
"react-native-web": "^0.20.0"
},
"devDependencies": {
- "@babel/core": "^7.20.0"
+ "@babel/core": "^7.20.0",
+ "jest": "^29.7.0",
+ "@jest/environment-jsdom": "^29.7.0",
+ "babel-jest": "^29.7.0"
},
- "private": true
+ "private": true,
+ "jest": {
+ "preset": "react-native",
+ "testEnvironment": "jsdom",
+ "setupFilesAfterEnv": [
+ "/jest.setup.js"
+ ],
+ "moduleFileExtensions": [
+ "js",
+ "jsx",
+ "json"
+ ],
+ "transform": {
+ "^.+\\.(js|jsx)$": "babel-jest"
+ },
+ "testMatch": [
+ "**/__tests__/**/*.(js|jsx)",
+ "**/*.(test|spec).(js|jsx)"
+ ],
+ "collectCoverageFrom": [
+ "api/**/*.{js,jsx}",
+ "!api/**/*.test.{js,jsx}",
+ "!**/node_modules/**"
+ ]
+ }
}
diff --git a/frontend/screens/FriendsScreen.test.js b/frontend/screens/FriendsScreen.test.js
new file mode 100644
index 00000000..63d87a9a
--- /dev/null
+++ b/frontend/screens/FriendsScreen.test.js
@@ -0,0 +1,597 @@
+import React from 'react';
+import { render, waitFor, fireEvent, act } from '@testing-library/react-native';
+import { Alert } from 'react-native';
+import { useIsFocused } from '@react-navigation/native';
+import FriendsScreen from './FriendsScreen';
+import { getFriendsBalance } from '../api/groups';
+import { AuthContext } from '../context/AuthContext';
+
+// Mock dependencies
+jest.mock('@react-navigation/native', () => ({
+ useIsFocused: jest.fn(),
+}));
+
+jest.mock('../api/groups', () => ({
+ getFriendsBalance: jest.fn(),
+}));
+
+jest.mock('react-native', () => {
+ const RN = jest.requireActual('react-native');
+ return {
+ ...RN,
+ Alert: {
+ alert: jest.fn(),
+ },
+ };
+});
+
+// Mock console.error to avoid noise in tests
+const originalConsoleError = console.error;
+beforeAll(() => {
+ console.error = jest.fn();
+});
+
+afterAll(() => {
+ console.error = originalConsoleError;
+});
+
+describe('FriendsScreen', () => {
+ const mockAuthContext = {
+ token: 'mock-token',
+ user: { id: '1', name: 'Test User' },
+ };
+
+ const mockFriendsResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '1',
+ userName: 'John Doe',
+ netBalance: 25.50,
+ breakdown: [
+ {
+ groupId: 'group1',
+ groupName: 'Group 1',
+ balance: 15.25,
+ },
+ {
+ groupId: 'group2',
+ groupName: 'Group 2',
+ balance: 10.25,
+ },
+ ],
+ },
+ {
+ userId: '2',
+ userName: 'Jane Smith',
+ netBalance: -12.75,
+ breakdown: [
+ {
+ groupId: 'group1',
+ groupName: 'Group 1',
+ balance: -12.75,
+ },
+ ],
+ },
+ ],
+ },
+ };
+
+ const renderWithContext = (contextValue = mockAuthContext) => {
+ return render(
+
+
+
+ );
+ };
+
+ beforeEach(() => {
+ jest.clearAllMocks();
+ useIsFocused.mockReturnValue(true);
+ getFriendsBalance.mockResolvedValue(mockFriendsResponse);
+ });
+
+ describe('Component Rendering', () => {
+ test('should render the Friends header', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Friends')).toBeTruthy();
+ });
+ });
+
+ test('should show loading indicator initially', () => {
+ const { queryByText } = renderWithContext();
+
+ // Component should be in loading state initially, so empty message shouldn't be visible yet
+ expect(queryByText('No balances with friends yet.')).toBeNull();
+ });
+
+ test('should render tooltip by default', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText(/These amounts show your direct balance with each friend/)).toBeTruthy();
+ });
+ });
+
+ test('should hide tooltip when close button is pressed', async () => {
+ const { getByText, queryByText, UNSAFE_getByType } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText(/These amounts show your direct balance with each friend/)).toBeTruthy();
+ });
+
+ // Find the IconButton by type since it may not have accessible role
+ const iconButtons = UNSAFE_getByType('IconButton');
+ fireEvent.press(iconButtons);
+
+ expect(queryByText(/These amounts show your direct balance with each friend/)).toBeNull();
+ });
+ });
+
+ describe('Data Fetching', () => {
+ test('should fetch friends data when component is focused and token exists', async () => {
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(getFriendsBalance).toHaveBeenCalledWith('mock-token');
+ });
+ });
+
+ test('should not fetch data when token is missing', async () => {
+ const contextWithoutToken = { ...mockAuthContext, token: null };
+ renderWithContext(contextWithoutToken);
+
+ await waitFor(() => {
+ expect(getFriendsBalance).not.toHaveBeenCalled();
+ }, { timeout: 1000 });
+ });
+
+ test('should not fetch data when screen is not focused', async () => {
+ useIsFocused.mockReturnValue(false);
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(getFriendsBalance).not.toHaveBeenCalled();
+ }, { timeout: 1000 });
+ });
+
+ test('should refetch data when token changes', async () => {
+ const { rerender } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getFriendsBalance).toHaveBeenCalledWith('mock-token');
+ });
+
+ const newContext = { ...mockAuthContext, token: 'new-token' };
+ rerender(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(getFriendsBalance).toHaveBeenCalledWith('new-token');
+ });
+ });
+ });
+
+ describe('Friends List Rendering', () => {
+ test('should render friends list after successful data fetch', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('John Doe')).toBeTruthy();
+ expect(getByText('Jane Smith')).toBeTruthy();
+ });
+ });
+
+ test('should display correct balance text for positive balance', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Owes you $25.50')).toBeTruthy();
+ });
+ });
+
+ test('should display correct balance text for negative balance', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You owe $12.75')).toBeTruthy();
+ });
+ });
+
+ test('should display settled up for zero balance', async () => {
+ const mockResponseWithZeroBalance = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '3',
+ userName: 'Zero Balance Friend',
+ netBalance: 0,
+ breakdown: [],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(mockResponseWithZeroBalance);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Settled up')).toBeTruthy();
+ });
+ });
+
+ test('should render group breakdown within friend accordion', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('John Doe')).toBeTruthy();
+ // Groups should be rendered as part of the accordion structure
+ expect(getByText('Group 1')).toBeTruthy();
+ expect(getByText('Group 2')).toBeTruthy();
+ });
+ });
+
+ test('should display empty state when no friends data', async () => {
+ getFriendsBalance.mockResolvedValue({ data: { friendsBalance: [] } });
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('No balances with friends yet.')).toBeTruthy();
+ });
+ });
+
+ test('should handle missing friendsBalance property', async () => {
+ getFriendsBalance.mockResolvedValue({ data: {} });
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('No balances with friends yet.')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Error Handling', () => {
+ test('should show error alert when API call fails', async () => {
+ const mockError = new Error('Network error');
+ getFriendsBalance.mockRejectedValue(mockError);
+
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(console.error).toHaveBeenCalledWith('Failed to fetch friends balance data:', mockError);
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to load friends balance data.');
+ });
+ });
+
+ test('should stop loading state after error', async () => {
+ getFriendsBalance.mockRejectedValue(new Error('Network error'));
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('No balances with friends yet.')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Data Transformation', () => {
+ test('should correctly transform backend data to frontend format', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Verify that the transformed data is correctly displayed
+ expect(getByText('John Doe')).toBeTruthy(); // userName -> name
+ expect(getByText('Owes you $25.50')).toBeTruthy(); // netBalance formatted
+ });
+ });
+
+ test('should handle friends with complex group structures', async () => {
+ const complexMockResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '4',
+ userName: 'Complex Friend',
+ netBalance: 100.00,
+ breakdown: [
+ {
+ groupId: 'g1',
+ groupName: 'Group Alpha',
+ balance: 50.00,
+ },
+ {
+ groupId: 'g2',
+ groupName: 'Group Beta',
+ balance: 30.00,
+ },
+ {
+ groupId: 'g3',
+ groupName: 'Group Gamma',
+ balance: 20.00,
+ },
+ ],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(complexMockResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Complex Friend')).toBeTruthy();
+ expect(getByText('Owes you $100.00')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Edge Cases', () => {
+ test('should handle very small positive balances', async () => {
+ const smallBalanceResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '5',
+ userName: 'Small Balance',
+ netBalance: 0.01,
+ breakdown: [{
+ groupId: 'g1',
+ groupName: 'Test Group',
+ balance: 0.01,
+ }],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(smallBalanceResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Owes you $0.01')).toBeTruthy();
+ });
+ });
+
+ test('should handle very small negative balances', async () => {
+ const smallNegativeBalanceResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '6',
+ userName: 'Small Negative Balance',
+ netBalance: -0.01,
+ breakdown: [{
+ groupId: 'g1',
+ groupName: 'Test Group',
+ balance: -0.01,
+ }],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(smallNegativeBalanceResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You owe $0.01')).toBeTruthy();
+ });
+ });
+
+ test('should handle friends with no groups', async () => {
+ const noGroupsResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '7',
+ userName: 'No Groups Friend',
+ netBalance: 25.00,
+ breakdown: [],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(noGroupsResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('No Groups Friend')).toBeTruthy();
+ expect(getByText('Owes you $25.00')).toBeTruthy();
+ });
+ });
+
+ test('should handle malformed API response gracefully', async () => {
+ getFriendsBalance.mockResolvedValue(null);
+
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(console.error).toHaveBeenCalled();
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to load friends balance data.');
+ });
+ });
+ });
+
+ describe('Balance Formatting', () => {
+ test('should format large balances correctly', async () => {
+ const largeBalanceResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '8',
+ userName: 'Rich Friend',
+ netBalance: 1234.56,
+ breakdown: [{
+ groupId: 'g1',
+ groupName: 'Expensive Group',
+ balance: 1234.56,
+ }],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(largeBalanceResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Owes you $1234.56')).toBeTruthy();
+ });
+ });
+
+ test('should handle balances with more than 2 decimal places', async () => {
+ const preciseBalanceResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '9',
+ userName: 'Precise Friend',
+ netBalance: 123.456789,
+ breakdown: [{
+ groupId: 'g1',
+ groupName: 'Precise Group',
+ balance: 123.456789,
+ }],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(preciseBalanceResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Owes you $123.46')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Component Lifecycle', () => {
+ test('should maintain tooltip state when component re-renders', async () => {
+ const { getByText, queryByText, UNSAFE_getByType, rerender } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText(/These amounts show your direct balance/)).toBeTruthy();
+ });
+
+ const iconButton = UNSAFE_getByType('IconButton');
+ fireEvent.press(iconButton);
+
+ expect(queryByText(/These amounts show your direct balance/)).toBeNull();
+
+ // Re-render with same context
+ rerender(
+
+
+
+ );
+
+ // Tooltip should remain hidden after re-render
+ expect(queryByText(/These amounts show your direct balance/)).toBeNull();
+ });
+
+ test('should handle undefined or null context gracefully', async () => {
+ const nullContext = { token: null, user: null };
+ const { queryByText } = renderWithContext(nullContext);
+
+ // Should not crash and should not fetch data
+ expect(getFriendsBalance).not.toHaveBeenCalled();
+
+ await waitFor(() => {
+ expect(queryByText('No balances with friends yet.')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Group Balance Display', () => {
+ test('should display correct color coding for positive group balances', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Verify group balance text is displayed
+ expect(getByText('Owes you $15.25')).toBeTruthy();
+ expect(getByText('Owes you $10.25')).toBeTruthy();
+ });
+ });
+
+ test('should display correct color coding for negative group balances', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Verify negative group balance text is displayed
+ expect(getByText('You owe $12.75')).toBeTruthy();
+ });
+ });
+
+ test('should handle zero group balances', async () => {
+ const zeroGroupBalanceResponse = {
+ data: {
+ friendsBalance: [
+ {
+ userId: '10',
+ userName: 'Zero Group Balance Friend',
+ netBalance: 0,
+ breakdown: [{
+ groupId: 'g1',
+ groupName: 'Zero Group',
+ balance: 0,
+ }],
+ },
+ ],
+ },
+ };
+
+ getFriendsBalance.mockResolvedValue(zeroGroupBalanceResponse);
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Zero Group Balance Friend')).toBeTruthy();
+ expect(getByText('Settled up')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Accessibility and UX', () => {
+ test('should have proper key extractors for FlatList', async () => {
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('John Doe')).toBeTruthy();
+ expect(getByText('Jane Smith')).toBeTruthy();
+ });
+
+ // The component should render without React key warnings
+ // This is implicitly tested by the successful rendering
+ });
+
+ test('should handle rapid state changes gracefully', async () => {
+ let resolvePromise;
+ const slowPromise = new Promise((resolve) => {
+ resolvePromise = resolve;
+ });
+
+ getFriendsBalance.mockReturnValue(slowPromise);
+ const { rerender } = renderWithContext();
+
+ // Change context while API call is pending
+ const newContext = { ...mockAuthContext, token: 'new-token' };
+ rerender(
+
+
+
+ );
+
+ // Resolve the promise
+ resolvePromise(mockFriendsResponse);
+
+ await waitFor(() => {
+ expect(getFriendsBalance).toHaveBeenCalledTimes(2);
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/frontend/screens/GroupDetailsScreen.test.js b/frontend/screens/GroupDetailsScreen.test.js
new file mode 100644
index 00000000..50e4521d
--- /dev/null
+++ b/frontend/screens/GroupDetailsScreen.test.js
@@ -0,0 +1,1078 @@
+import React from 'react';
+import { render, fireEvent, waitFor, act } from '@testing-library/react-native';
+import { Alert } from 'react-native';
+import GroupDetailsScreen from './GroupDetailsScreen';
+import { AuthContext } from '../context/AuthContext';
+import { getGroupExpenses, getGroupMembers, getOptimizedSettlements } from '../api/groups';
+
+// Mock the API functions
+jest.mock('../api/groups', () => ({
+ getGroupExpenses: jest.fn(),
+ getGroupMembers: jest.fn(),
+ getOptimizedSettlements: jest.fn(),
+}));
+
+// Mock React Native components and modules
+jest.mock('react-native', () => {
+ const RN = jest.requireActual('react-native');
+ return {
+ ...RN,
+ Alert: {
+ alert: jest.fn(),
+ },
+ };
+});
+
+// Mock react-native-paper components
+jest.mock('react-native-paper', () => ({
+ ActivityIndicator: ({ testID }) => {
+ const React = require('react');
+ const { View } = require('react-native');
+ return React.createElement(View, { testID: testID || 'activity-indicator' });
+ },
+ Card: Object.assign(
+ ({ children, style }) => {
+ const React = require('react');
+ const { View } = require('react-native');
+ return React.createElement(View, { style, testID: 'card' }, children);
+ },
+ {
+ Content: ({ children }) => {
+ const React = require('react');
+ const { View } = require('react-native');
+ return React.createElement(View, { testID: 'card-content' }, children);
+ },
+ }
+ ),
+ FAB: ({ onPress, testID, icon }) => {
+ const React = require('react');
+ const { TouchableOpacity, Text } = require('react-native');
+ return React.createElement(
+ TouchableOpacity,
+ { onPress, testID: testID || 'fab' },
+ React.createElement(Text, null, icon)
+ );
+ },
+ Paragraph: ({ children, style }) => {
+ const React = require('react');
+ const { Text } = require('react-native');
+ return React.createElement(Text, { style }, children);
+ },
+ Title: ({ children, style }) => {
+ const React = require('react');
+ const { Text } = require('react-native');
+ return React.createElement(Text, { style }, children);
+ },
+}));
+
+// Mock navigation
+const mockNavigation = {
+ setOptions: jest.fn(),
+ navigate: jest.fn(),
+};
+
+// Mock route
+const mockRoute = {
+ params: {
+ groupId: 'group123',
+ groupName: 'Test Group',
+ groupIcon: 'group-icon',
+ },
+};
+
+// Mock AuthContext values
+const mockAuthContext = {
+ token: 'test-token',
+ user: {
+ _id: 'user123',
+ name: 'Test User',
+ },
+};
+
+// Helper function to render component with context
+const renderWithContext = (authContext = mockAuthContext) => {
+ return render(
+
+
+
+ );
+};
+
+describe('GroupDetailsScreen', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ Alert.alert.mockClear();
+ });
+
+ describe('Initial Loading and Setup', () => {
+ it('should set navigation title on mount', () => {
+ renderWithContext();
+ expect(mockNavigation.setOptions).toHaveBeenCalledWith({
+ title: 'Test Group',
+ });
+ });
+
+ it('should show loading indicator initially', () => {
+ // Mock all API calls to never resolve to keep loading state
+ getGroupMembers.mockImplementation(() => new Promise(() => {}));
+ getGroupExpenses.mockImplementation(() => new Promise(() => {}));
+ getOptimizedSettlements.mockImplementation(() => new Promise(() => {}));
+
+ const { getByTestId } = renderWithContext();
+ expect(getByTestId('activity-indicator')).toBeTruthy();
+ });
+
+ it('should not fetch data when token is missing', () => {
+ renderWithContext({ ...mockAuthContext, token: null });
+ expect(getGroupExpenses).not.toHaveBeenCalled();
+ expect(getGroupMembers).not.toHaveBeenCalled();
+ expect(getOptimizedSettlements).not.toHaveBeenCalled();
+ });
+
+ it('should not fetch data when groupId is missing', () => {
+ const routeWithoutGroupId = {
+ params: {
+ groupId: null,
+ groupName: 'Test Group',
+ groupIcon: 'group-icon',
+ },
+ };
+ render(
+
+
+
+ );
+ expect(getGroupExpenses).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('Data Fetching', () => {
+ const mockMembers = [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } },
+ ];
+
+ const mockExpenses = [
+ {
+ _id: 'expense1',
+ description: 'Lunch',
+ amount: 100,
+ paidBy: 'user123',
+ createdBy: 'user123',
+ splits: [
+ { userId: 'user123', amount: 50 },
+ { userId: 'user456', amount: 50 },
+ ],
+ },
+ ];
+
+ const mockSettlements = [
+ {
+ fromUserId: 'user456',
+ toUserId: 'user123',
+ amount: 25,
+ },
+ ];
+
+ it('should fetch all data successfully', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'group123');
+ expect(getGroupExpenses).toHaveBeenCalledWith('test-token', 'group123');
+ expect(getOptimizedSettlements).toHaveBeenCalledWith('test-token', 'group123');
+ });
+
+ await waitFor(() => {
+ expect(getByText('Settlement Summary')).toBeTruthy();
+ expect(getByText('Members')).toBeTruthy();
+ expect(getByText('Expenses')).toBeTruthy();
+ });
+ });
+
+ it('should handle API errors gracefully', async () => {
+ const error = new Error('Network error');
+ getGroupMembers.mockRejectedValue(error);
+ getGroupExpenses.mockRejectedValue(error);
+ getOptimizedSettlements.mockRejectedValue(error);
+
+ const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch group details.');
+ });
+
+ consoleSpy.mockRestore();
+ });
+
+ it('should handle missing settlements data', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: {} });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('✓ You are all settled up!')).toBeTruthy();
+ });
+ });
+
+ it('should fetch data when both token and groupId are present', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ renderWithContext();
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'group123');
+ expect(getGroupExpenses).toHaveBeenCalledWith('test-token', 'group123');
+ expect(getOptimizedSettlements).toHaveBeenCalledWith('test-token', 'group123');
+ });
+ });
+ });
+
+ describe('Currency Formatting', () => {
+ it('should format currency with INR symbol and two decimal places', async () => {
+ const mockMembers = [{ userId: 'user123', user: { name: 'Test User' } }];
+ const mockExpenses = [{
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 123.45,
+ paidBy: 'user123',
+ splits: [{ userId: 'user123', amount: 123.45 }],
+ }];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Amount: ₹123.45')).toBeTruthy();
+ });
+ });
+
+ it('should format whole numbers with .00', async () => {
+ const mockMembers = [{ userId: 'user123', user: { name: 'Test User' } }];
+ const mockExpenses = [{
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 100,
+ paidBy: 'user123',
+ splits: [{ userId: 'user123', amount: 100 }],
+ }];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Amount: ₹100.00')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Member Name Resolution', () => {
+ const mockMembers = [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } },
+ ];
+
+ it('should resolve member names correctly', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('• Test User')).toBeTruthy();
+ expect(getByText('• Jane Doe')).toBeTruthy();
+ });
+ });
+
+ it('should handle unknown users gracefully', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({
+ data: {
+ expenses: [{
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 100,
+ paidBy: 'unknown-user',
+ splits: [{ userId: 'user123', amount: 100 }],
+ }],
+ },
+ });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Paid by: Unknown')).toBeTruthy();
+ });
+ });
+
+ it('should return "Unknown" for non-existent user IDs in settlements', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({
+ data: {
+ optimizedSettlements: [{
+ fromUserId: 'user123',
+ toUserId: 'nonexistent-user',
+ amount: 50,
+ }],
+ },
+ });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Unknown')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Expense Rendering', () => {
+ const mockMembers = [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } },
+ ];
+
+ it('should render expense when user is owed money', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Lunch',
+ amount: 100,
+ paidBy: 'user123',
+ splits: [
+ { userId: 'user123', amount: 40 },
+ { userId: 'user456', amount: 60 },
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Lunch')).toBeTruthy();
+ expect(getByText('Amount: ₹100.00')).toBeTruthy();
+ expect(getByText('Paid by: Test User')).toBeTruthy();
+ expect(getByText('You are owed ₹60.00')).toBeTruthy();
+ });
+ });
+
+ it('should render expense when user owes money', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Dinner',
+ amount: 100,
+ paidBy: 'user456',
+ splits: [
+ { userId: 'user123', amount: 60 },
+ { userId: 'user456', amount: 40 },
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Dinner')).toBeTruthy();
+ expect(getByText('You borrowed ₹60.00')).toBeTruthy();
+ });
+ });
+
+ it('should render expense when user is settled', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Coffee',
+ amount: 100,
+ paidBy: 'user123',
+ splits: [
+ { userId: 'user123', amount: 100 },
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Coffee')).toBeTruthy();
+ expect(getByText('You are settled for this expense.')).toBeTruthy();
+ });
+ });
+
+ it('should handle expenses with missing splits', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 100,
+ paidBy: 'user456',
+ splits: [],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Test Expense')).toBeTruthy();
+ expect(getByText('You borrowed ₹0.00')).toBeTruthy();
+ });
+ });
+
+ it('should use createdBy when paidBy is missing', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 100,
+ createdBy: 'user456',
+ splits: [{ userId: 'user123', amount: 50 }],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Paid by: Jane Doe')).toBeTruthy();
+ });
+ });
+
+ it('should handle expenses with null splits array', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Test Expense',
+ amount: 100,
+ paidBy: 'user456',
+ splits: null,
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Test Expense')).toBeTruthy();
+ // Should not crash and should show some default behavior
+ });
+ });
+ });
+
+ describe('Settlement Summary', () => {
+ const mockMembers = [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } },
+ { userId: 'user789', user: { name: 'Bob Smith' } },
+ ];
+
+ it('should show settled message when no settlements exist', async () => {
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('✓ You are all settled up!')).toBeTruthy();
+ });
+ });
+
+ it('should show amounts user owes', async () => {
+ const settlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
+ { fromUserId: 'user123', toUserId: 'user789', amount: 30 },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You need to pay: ₹80.00')).toBeTruthy();
+ expect(getByText('Jane Doe')).toBeTruthy();
+ expect(getByText('Bob Smith')).toBeTruthy();
+ expect(getByText('₹50.00')).toBeTruthy();
+ expect(getByText('₹30.00')).toBeTruthy();
+ });
+ });
+
+ it('should show amounts user will receive', async () => {
+ const settlements = [
+ { fromUserId: 'user456', toUserId: 'user123', amount: 40 },
+ { fromUserId: 'user789', toUserId: 'user123', amount: 20 },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You will receive: ₹60.00')).toBeTruthy();
+ expect(getByText('Jane Doe')).toBeTruthy();
+ expect(getByText('Bob Smith')).toBeTruthy();
+ });
+ });
+
+ it('should show both owing and receiving sections', async () => {
+ const settlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 25 },
+ { fromUserId: 'user789', toUserId: 'user123', amount: 35 },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You need to pay: ₹25.00')).toBeTruthy();
+ expect(getByText('You will receive: ₹35.00')).toBeTruthy();
+ });
+ });
+
+ it('should handle settlements with unknown users', async () => {
+ const settlements = [
+ { fromUserId: 'user123', toUserId: 'unknown-user', amount: 25 },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Unknown')).toBeTruthy();
+ });
+ });
+
+ it('should calculate totals correctly for complex settlements', async () => {
+ const settlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 25.50 },
+ { fromUserId: 'user123', toUserId: 'user789', amount: 30.75 },
+ { fromUserId: 'user456', toUserId: 'user123', amount: 15.25 },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: mockMembers });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('You need to pay: ₹56.25')).toBeTruthy(); // 25.50 + 30.75
+ expect(getByText('You will receive: ₹15.25')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Empty States', () => {
+ it('should show empty expenses message', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('No expenses recorded yet.')).toBeTruthy();
+ });
+ });
+
+ it('should show members section even when empty', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Members')).toBeTruthy();
+ });
+ });
+
+ it('should handle empty API responses gracefully', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Settlement Summary')).toBeTruthy();
+ expect(getByText('Members')).toBeTruthy();
+ expect(getByText('Expenses')).toBeTruthy();
+ expect(getByText('✓ You are all settled up!')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('FAB Navigation', () => {
+ it('should navigate to AddExpense screen when FAB is pressed', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByTestId } = renderWithContext();
+
+ await waitFor(() => {
+ const fab = getByTestId('fab');
+ fireEvent.press(fab);
+ expect(mockNavigation.navigate).toHaveBeenCalledWith('AddExpense', {
+ groupId: 'group123',
+ });
+ });
+ });
+
+ it('should pass correct groupId to AddExpense screen', async () => {
+ const customRoute = {
+ params: {
+ groupId: 'custom-group-456',
+ groupName: 'Custom Group',
+ groupIcon: 'custom-icon',
+ },
+ };
+
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByTestId } = render(
+
+
+
+ );
+
+ await waitFor(() => {
+ const fab = getByTestId('fab');
+ fireEvent.press(fab);
+ expect(mockNavigation.navigate).toHaveBeenCalledWith('AddExpense', {
+ groupId: 'custom-group-456',
+ });
+ });
+ });
+ });
+
+ describe('Edge Cases and Error Handling', () => {
+ it('should handle null/undefined values in expenses', async () => {
+ const expenseWithNulls = {
+ _id: 'expense1',
+ description: null,
+ amount: null,
+ paidBy: null,
+ createdBy: null,
+ splits: null,
+ };
+
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expenseWithNulls] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ // Should not crash when rendering
+ expect(() => renderWithContext()).not.toThrow();
+ });
+
+ it('should handle malformed API responses', async () => {
+ getGroupMembers.mockResolvedValue({ data: null });
+ getGroupExpenses.mockResolvedValue({ data: null });
+ getOptimizedSettlements.mockResolvedValue({ data: null });
+
+ // Should not crash when handling null responses
+ expect(() => renderWithContext()).not.toThrow();
+ });
+
+ it('should handle very large numbers in currency formatting', async () => {
+ const expenseWithLargeAmount = {
+ _id: 'expense1',
+ description: 'Expensive Item',
+ amount: 999999999.99,
+ paidBy: 'user123',
+ splits: [{ userId: 'user123', amount: 999999999.99 }],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expenseWithLargeAmount] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Amount: ₹999999999.99')).toBeTruthy();
+ });
+ });
+
+ it('should handle zero amounts correctly', async () => {
+ const zeroAmountExpense = {
+ _id: 'expense1',
+ description: 'Free Item',
+ amount: 0,
+ paidBy: 'user123',
+ splits: [{ userId: 'user123', amount: 0 }],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [zeroAmountExpense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Amount: ₹0.00')).toBeTruthy();
+ expect(getByText('You are settled for this expense.')).toBeTruthy();
+ });
+ });
+
+ it('should handle negative amounts gracefully', async () => {
+ const negativeAmountExpense = {
+ _id: 'expense1',
+ description: 'Refund',
+ amount: -50,
+ paidBy: 'user123',
+ splits: [{ userId: 'user123', amount: -50 }],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [negativeAmountExpense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Amount: ₹-50.00')).toBeTruthy();
+ });
+ });
+
+ it('should handle missing user in auth context', () => {
+ const contextWithoutUser = {
+ token: 'test-token',
+ user: null,
+ };
+
+ expect(() => renderWithContext(contextWithoutUser)).not.toThrow();
+ });
+
+ it('should handle API responses with missing data fields', async () => {
+ getGroupMembers.mockResolvedValue({});
+ getGroupExpenses.mockResolvedValue({});
+ getOptimizedSettlements.mockResolvedValue({});
+
+ expect(() => renderWithContext()).not.toThrow();
+ });
+ });
+
+ describe('Component State Management', () => {
+ it('should update loading state correctly during data fetch', async () => {
+ let resolvePromises;
+ const promises = new Promise(resolve => { resolvePromises = resolve; });
+
+ getGroupMembers.mockImplementation(() => promises);
+ getGroupExpenses.mockImplementation(() => promises);
+ getOptimizedSettlements.mockImplementation(() => promises);
+
+ const { getByTestId, queryByTestId } = renderWithContext();
+
+ // Should show loading initially
+ expect(getByTestId('activity-indicator')).toBeTruthy();
+
+ // Resolve promises
+ act(() => {
+ resolvePromises({ data: [] });
+ });
+
+ await waitFor(() => {
+ expect(queryByTestId('activity-indicator')).toBeNull();
+ });
+ });
+
+ it('should maintain state consistency after multiple re-renders', async () => {
+ const mockData = {
+ members: [{ userId: 'user123', user: { name: 'Test User' } }],
+ expenses: [],
+ settlements: [],
+ };
+
+ getGroupMembers.mockResolvedValue({ data: mockData.members });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: mockData.expenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockData.settlements } });
+
+ const { rerender, getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('• Test User')).toBeTruthy();
+ });
+
+ // Re-render with same props
+ rerender(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(getByText('• Test User')).toBeTruthy();
+ });
+ });
+
+ it('should handle concurrent API calls correctly', async () => {
+ let resolveMembers, resolveExpenses, resolveSettlements;
+
+ getGroupMembers.mockImplementation(() => new Promise(resolve => { resolveMembers = resolve; }));
+ getGroupExpenses.mockImplementation(() => new Promise(resolve => { resolveExpenses = resolve; }));
+ getOptimizedSettlements.mockImplementation(() => new Promise(resolve => { resolveSettlements = resolve; }));
+
+ renderWithContext();
+
+ // Resolve in different order
+ act(() => {
+ resolveExpenses({ data: { expenses: [] } });
+ resolveSettlements({ data: { optimizedSettlements: [] } });
+ resolveMembers({ data: [] });
+ });
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalled();
+ expect(getGroupExpenses).toHaveBeenCalled();
+ expect(getOptimizedSettlements).toHaveBeenCalled();
+ });
+ });
+ });
+
+ describe('Accessibility and Performance', () => {
+ it('should have proper key extractors for FlatList', async () => {
+ const expenses = [
+ { _id: 'expense1', description: 'Test 1', amount: 100, paidBy: 'user123', splits: [] },
+ { _id: 'expense2', description: 'Test 2', amount: 200, paidBy: 'user123', splits: [] },
+ ];
+
+ getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getByText('Test 1')).toBeTruthy();
+ expect(getByText('Test 2')).toBeTruthy();
+ });
+ });
+
+ it('should handle rapid state updates without race conditions', async () => {
+ let callCount = 0;
+ getGroupMembers.mockImplementation(() => {
+ callCount++;
+ return Promise.resolve({ data: [{ userId: `user${callCount}`, user: { name: `User ${callCount}` } }] });
+ });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { rerender } = renderWithContext();
+
+ // Trigger multiple re-renders quickly
+ for (let i = 0; i < 3; i++) {
+ rerender(
+
+
+
+ );
+ }
+
+ await waitFor(() => {
+ // Should eventually settle without crashing
+ expect(getGroupMembers).toHaveBeenCalled();
+ });
+ });
+
+ it('should render cards with proper structure', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getAllByTestId } = renderWithContext();
+
+ await waitFor(() => {
+ const cards = getAllByTestId('card');
+ expect(cards.length).toBeGreaterThan(0);
+ });
+ });
+ });
+
+ describe('Calculation Logic', () => {
+ it('should calculate net balance correctly for user who paid', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Shared Lunch',
+ amount: 120,
+ paidBy: 'user123', // Current user paid
+ splits: [
+ { userId: 'user123', amount: 60 }, // Current user's share
+ { userId: 'user456', amount: 60 }, // Other user's share
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({
+ data: [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } }
+ ]
+ });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Net = 120 (paid) - 60 (share) = 60 (owed)
+ expect(getByText('You are owed ₹60.00')).toBeTruthy();
+ });
+ });
+
+ it('should calculate net balance correctly for user who did not pay', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Shared Dinner',
+ amount: 150,
+ paidBy: 'user456', // Other user paid
+ splits: [
+ { userId: 'user123', amount: 75 }, // Current user's share
+ { userId: 'user456', amount: 75 }, // Other user's share
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({
+ data: [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } }
+ ]
+ });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Net = 0 (paid) - 75 (share) = -75 (borrowed)
+ expect(getByText('You borrowed ₹75.00')).toBeTruthy();
+ });
+ });
+
+ it('should handle unequal splits correctly', async () => {
+ const expense = {
+ _id: 'expense1',
+ description: 'Unequal Split',
+ amount: 100,
+ paidBy: 'user123',
+ splits: [
+ { userId: 'user123', amount: 30 }, // Current user's smaller share
+ { userId: 'user456', amount: 70 }, // Other user's larger share
+ ],
+ };
+
+ getGroupMembers.mockResolvedValue({
+ data: [
+ { userId: 'user123', user: { name: 'Test User' } },
+ { userId: 'user456', user: { name: 'Jane Doe' } }
+ ]
+ });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithContext();
+
+ await waitFor(() => {
+ // Net = 100 (paid) - 30 (share) = 70 (owed)
+ expect(getByText('You are owed ₹70.00')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('useEffect Dependencies', () => {
+ it('should refetch data when token changes', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { rerender } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledTimes(1);
+ });
+
+ // Change token
+ rerender(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledWith('new-token', 'group123');
+ expect(getGroupMembers).toHaveBeenCalledTimes(2);
+ });
+ });
+
+ it('should refetch data when groupId changes', async () => {
+ getGroupMembers.mockResolvedValue({ data: [] });
+ getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { rerender } = renderWithContext();
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledTimes(1);
+ });
+
+ // Change groupId
+ const newRoute = {
+ params: {
+ groupId: 'new-group-456',
+ groupName: 'New Group',
+ groupIcon: 'new-icon',
+ },
+ };
+
+ rerender(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'new-group-456');
+ expect(getGroupMembers).toHaveBeenCalledTimes(2);
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/frontend/screens/HomeScreen.js b/frontend/screens/HomeScreen.js
index 226aea44..c361f74e 100644
--- a/frontend/screens/HomeScreen.js
+++ b/frontend/screens/HomeScreen.js
@@ -185,10 +185,10 @@ const HomeScreen = ({ navigation }) => {
{isLoading ? (
-
+
) : (
- item._id}
diff --git a/frontend/screens/HomeScreen.test.js b/frontend/screens/HomeScreen.test.js
new file mode 100644
index 00000000..d11be231
--- /dev/null
+++ b/frontend/screens/HomeScreen.test.js
@@ -0,0 +1,851 @@
+import React from 'react';
+import { render, fireEvent, waitFor, act } from '@testing-library/react-native';
+import { Alert } from 'react-native';
+import HomeScreen from './HomeScreen';
+import { AuthContext } from '../context/AuthContext';
+import { createGroup, getGroups, getOptimizedSettlements } from '../api/groups';
+
+// Mock the API functions
+jest.mock('../api/groups', () => ({
+ createGroup: jest.fn(),
+ getGroups: jest.fn(),
+ getOptimizedSettlements: jest.fn(),
+}));
+
+// Mock Alert
+jest.spyOn(Alert, 'alert').mockImplementation(() => {});
+
+// Mock console.error to avoid noise in test output
+const mockConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
+
+// Mock navigation
+const mockNavigation = {
+ navigate: jest.fn(),
+};
+
+// Mock AuthContext values
+const mockAuthContextValue = {
+ token: 'mock-token-123',
+ logout: jest.fn(),
+ user: { _id: 'user123', name: 'Test User' },
+};
+
+const renderWithAuthContext = (authValue = mockAuthContextValue) => {
+ return render(
+
+
+
+ );
+};
+
+describe('HomeScreen', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ Alert.alert.mockClear();
+ mockNavigation.navigate.mockClear();
+ mockConsoleError.mockClear();
+ });
+
+ afterAll(() => {
+ mockConsoleError.mockRestore();
+ });
+
+ describe('Initial Loading and Data Fetching', () => {
+ it('should display loading indicator initially', async () => {
+ getGroups.mockImplementation(() => new Promise(() => {})); // Never resolves
+
+ const { getByTestId } = renderWithAuthContext();
+
+ expect(getByTestId('loading-indicator')).toBeTruthy();
+ });
+
+ it('should fetch groups on mount when token is available', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group 1', joinCode: 'ABC123', icon: 'T' },
+ ];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ await waitFor(() => {
+ expect(getGroups).toHaveBeenCalledWith('mock-token-123');
+ });
+ });
+
+ it('should not fetch groups when token is not available', () => {
+ const authValueWithoutToken = { ...mockAuthContextValue, token: null };
+
+ renderWithAuthContext(authValueWithoutToken);
+
+ expect(getGroups).not.toHaveBeenCalled();
+ });
+
+ it('should handle error when fetching groups fails', async () => {
+ getGroups.mockRejectedValue(new Error('Network error'));
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ await waitFor(() => {
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch groups.');
+ });
+ });
+
+ it('should set loading to false after groups are fetched', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' },
+ ];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { queryByTestId } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(queryByTestId('loading-indicator')).toBeNull();
+ });
+ });
+ });
+
+ describe('Settlement Status Calculations', () => {
+ it('should calculate settlement status when user owes money', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
+ { fromUserId: 'user789', toUserId: 'user123', amount: 20 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ await waitFor(() => {
+ expect(getOptimizedSettlements).toHaveBeenCalledWith('mock-token-123', 'group1');
+ });
+ });
+
+ it('should calculate settlement status when user is owed money', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user456', toUserId: 'user123', amount: 75 },
+ { fromUserId: 'user123', toUserId: 'user789', amount: 25 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ await waitFor(() => {
+ expect(getOptimizedSettlements).toHaveBeenCalledWith('mock-token-123', 'group1');
+ });
+ });
+
+ it('should handle settlement calculation error gracefully', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockRejectedValue(new Error('Settlement error'));
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ await waitFor(() => {
+ expect(mockConsoleError).toHaveBeenCalledWith(
+ 'Failed to fetch settlement status for group:',
+ 'group1',
+ expect.any(Error)
+ );
+ });
+ });
+
+ it('should calculate correct net balance for complex settlements', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 30 },
+ { fromUserId: 'user456', toUserId: 'user123', amount: 50 },
+ { fromUserId: 'user789', toUserId: 'user123', amount: 25 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ // Net balance: (50 + 25) - 30 = 45, so user is owed $45
+ expect(getByText('You are owed $45.00.')).toBeTruthy();
+ });
+ });
+
+ it('should handle settlements with undefined amounts', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: undefined },
+ { fromUserId: 'user456', toUserId: 'user123', amount: null },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('✓ You are settled up.')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Group Rendering and UI', () => {
+ it('should render groups list when data is loaded', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group 1', joinCode: 'ABC123', icon: 'T' },
+ { _id: 'group2', name: 'Test Group 2', joinCode: 'XYZ789', icon: 'G' },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('Test Group 1')).toBeTruthy();
+ expect(getByText('Test Group 2')).toBeTruthy();
+ expect(getByText('Join Code: ABC123')).toBeTruthy();
+ expect(getByText('Join Code: XYZ789')).toBeTruthy();
+ });
+ });
+
+ it('should display empty state when no groups exist', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('No groups found. Create or join one!')).toBeTruthy();
+ });
+ });
+
+ it('should navigate to group details when group card is pressed', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group', joinCode: 'ABC123', icon: 'T' },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const groupCard = getByText('Test Group');
+ fireEvent.press(groupCard);
+ });
+
+ expect(mockNavigation.navigate).toHaveBeenCalledWith('GroupDetails', {
+ groupId: 'group1',
+ groupName: 'Test Group',
+ groupIcon: 'T',
+ });
+ });
+
+ it('should render group avatar with icon when provided', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group', joinCode: 'ABC123', icon: '🏠' },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('🏠')).toBeTruthy();
+ });
+ });
+
+ it('should render group avatar with first letter when no icon provided', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }, // No icon
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('T')).toBeTruthy(); // First letter of "Test Group"
+ });
+ });
+ });
+
+ describe('Settlement Status Display', () => {
+ it('should display "Calculating balances..." when settlement status is loading', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ // Delay the settlement response to simulate loading
+ getOptimizedSettlements.mockImplementation(() => new Promise(resolve =>
+ setTimeout(() => resolve({ data: { optimizedSettlements: [] } }), 100)
+ ));
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('Calculating balances...')).toBeTruthy();
+ });
+ });
+
+ it('should display settled status correctly', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('✓ You are settled up.')).toBeTruthy();
+ });
+ });
+
+ it('should display owed amount with correct formatting', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user456', toUserId: 'user123', amount: 50.755 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('You are owed $50.76.')).toBeTruthy(); // Rounded to 2 decimal places
+ });
+ });
+
+ it('should display owing amount with correct formatting', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 25.504 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('You owe $25.50.')).toBeTruthy(); // Rounded to 2 decimal places
+ });
+ });
+
+ it('should handle zero net balance as settled', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
+ { fromUserId: 'user456', toUserId: 'user123', amount: 50 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('You are settled up.')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Create Group Modal', () => {
+ it('should show modal when plus icon is pressed', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const plusButton = getByLabelText('plus');
+ fireEvent.press(plusButton);
+ });
+
+ expect(getByText('Create a New Group')).toBeTruthy();
+ });
+
+ it('should update group name input when text changes', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByDisplayValue } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, 'New Test Group');
+
+ expect(getByDisplayValue('New Test Group')).toBeTruthy();
+ });
+
+ it('should show error when creating group without name', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ fireEvent.press(getByText('Create'));
+
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter a group name.');
+ });
+
+ it('should show error when creating group with empty name', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, ' '); // Whitespace only
+ fireEvent.press(getByText('Create'));
+
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter a group name.');
+ });
+
+ it('should create group successfully and refresh list', async () => {
+ const initialGroups = [];
+ const updatedGroups = [{ _id: 'newgroup1', name: 'New Test Group', joinCode: 'NEW123' }];
+
+ createGroup.mockResolvedValue({ data: { success: true } });
+ getGroups
+ .mockResolvedValueOnce({ data: { groups: initialGroups } })
+ .mockResolvedValueOnce({ data: { groups: updatedGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByLabelText, getByText, queryByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, 'New Test Group');
+
+ await act(async () => {
+ fireEvent.press(getByText('Create'));
+ });
+
+ expect(createGroup).toHaveBeenCalledWith('mock-token-123', 'New Test Group');
+
+ // Modal should be hidden
+ await waitFor(() => {
+ expect(queryByText('Create a New Group')).toBeNull();
+ });
+
+ // Groups list should be refreshed
+ expect(getGroups).toHaveBeenCalledTimes(2);
+ });
+
+ it('should handle group creation error', async () => {
+ createGroup.mockRejectedValue(new Error('Creation failed'));
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, 'New Test Group');
+
+ await act(async () => {
+ fireEvent.press(getByText('Create'));
+ });
+
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to create group.');
+ });
+
+ it('should show loading state while creating group', async () => {
+ let resolveCreate;
+ createGroup.mockImplementation(() => new Promise(resolve => {
+ resolveCreate = resolve;
+ }));
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, 'New Test Group');
+
+ act(() => {
+ fireEvent.press(getByText('Create'));
+ });
+
+ // Button should be disabled and show loading
+ const createButton = getByText('Create');
+ expect(createButton.props.disabled).toBeTruthy();
+
+ // Resolve the creation
+ act(() => {
+ resolveCreate({ data: { success: true } });
+ });
+ });
+
+ it('should clear input after successful group creation', async () => {
+ createGroup.mockResolvedValue({ data: { success: true } });
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText, getByText, queryByDisplayValue } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('plus'));
+ });
+
+ const input = getByLabelText('Group Name');
+ fireEvent.changeText(input, 'New Test Group');
+
+ await act(async () => {
+ fireEvent.press(getByText('Create'));
+ });
+
+ // After successful creation, input should be cleared
+ await waitFor(() => {
+ expect(queryByDisplayValue('New Test Group')).toBeNull();
+ });
+ });
+ });
+
+ describe('Navigation Actions', () => {
+ it('should navigate to JoinGroup screen with callback when account-plus icon is pressed', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('account-plus'));
+ });
+
+ expect(mockNavigation.navigate).toHaveBeenCalledWith('JoinGroup', {
+ onGroupJoined: expect.any(Function),
+ });
+ });
+
+ it('should provide fetchGroups as callback to JoinGroup screen', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { getByLabelText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ fireEvent.press(getByLabelText('account-plus'));
+ });
+
+ const navigateCall = mockNavigation.navigate.mock.calls[0];
+ const callback = navigateCall[1].onGroupJoined;
+
+ // Calling the callback should trigger fetchGroups
+ await act(async () => {
+ await callback();
+ });
+
+ // Should have been called twice - once on mount, once from callback
+ expect(getGroups).toHaveBeenCalledTimes(2);
+ });
+ });
+
+ describe('Pull to Refresh', () => {
+ it('should refresh groups when pull to refresh is triggered', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByTestId } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getGroups).toHaveBeenCalledTimes(1);
+ });
+
+ // Simulate pull to refresh
+ const flatList = getByTestId('groups-flatlist');
+ await act(async () => {
+ fireEvent(flatList, 'onRefresh');
+ });
+
+ expect(getGroups).toHaveBeenCalledTimes(2);
+ });
+
+ it('should show refreshing indicator during pull to refresh', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ let resolveRefresh;
+ getGroups
+ .mockResolvedValueOnce({ data: { groups: mockGroups } })
+ .mockImplementationOnce(() => new Promise(resolve => {
+ resolveRefresh = resolve;
+ }));
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByTestId } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getGroups).toHaveBeenCalledTimes(1);
+ });
+
+ const flatList = getByTestId('groups-flatlist');
+ act(() => {
+ fireEvent(flatList, 'onRefresh');
+ });
+
+ // Should show refreshing state
+ expect(flatList.props.refreshing).toBeTruthy();
+
+ // Resolve the refresh
+ act(() => {
+ resolveRefresh({ data: { groups: mockGroups } });
+ });
+ });
+ });
+
+ describe('Edge Cases and Error Handling', () => {
+ it('should handle missing user ID when calculating settlements', async () => {
+ const authValueWithoutUserId = {
+ ...mockAuthContextValue,
+ user: null,
+ };
+
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+
+ await act(async () => {
+ renderWithAuthContext(authValueWithoutUserId);
+ });
+
+ // Should not call getOptimizedSettlements when user ID is not available
+ expect(getOptimizedSettlements).not.toHaveBeenCalled();
+ });
+
+ it('should handle user object without _id property', async () => {
+ const authValueWithIncompleteUser = {
+ ...mockAuthContextValue,
+ user: { name: 'Test User' }, // Missing _id
+ };
+
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+
+ await act(async () => {
+ renderWithAuthContext(authValueWithIncompleteUser);
+ });
+
+ expect(getOptimizedSettlements).not.toHaveBeenCalled();
+ });
+
+ it('should handle groups with missing properties gracefully', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }, // No icon
+ { _id: 'group2', name: '', joinCode: 'XYZ789', icon: 'T' }, // Empty name
+ { _id: 'group3', name: 'Group 3' }, // No joinCode
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText, queryByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('Test Group')).toBeTruthy();
+ expect(getByText('Join Code: ABC123')).toBeTruthy();
+ expect(queryByText('Join Code: undefined')).toBeNull();
+ });
+ });
+
+ it('should handle malformed API response for groups', async () => {
+ getGroups.mockResolvedValue({ data: {} }); // Missing groups array
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ // Should handle gracefully without crashing
+ expect(mockConsoleError).toHaveBeenCalled();
+ });
+
+ it('should handle malformed API response for settlements', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: {} }); // Missing optimizedSettlements
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getByText('✓ You are settled up.')).toBeTruthy();
+ });
+ });
+
+ it('should handle network timeout errors', async () => {
+ const timeoutError = new Error('Network timeout');
+ timeoutError.code = 'ECONNABORTED';
+ getGroups.mockRejectedValue(timeoutError);
+
+ await act(async () => {
+ renderWithAuthContext();
+ });
+
+ expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch groups.');
+ });
+
+ it('should handle empty group names', async () => {
+ const mockGroups = [
+ { _id: 'group1', name: '', joinCode: 'ABC123' },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ // Should still display something for the group
+ expect(getByText('Join Code: ABC123')).toBeTruthy();
+ });
+ });
+ });
+
+ describe('Status Color Logic', () => {
+ it('should apply green color for settled status', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const statusText = getByText('✓ You are settled up.');
+ expect(statusText.props.style).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ color: '#4CAF50' })
+ ])
+ );
+ });
+ });
+
+ it('should apply red color when user owes money', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user123', toUserId: 'user456', amount: 25 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const statusText = getByText('You owe $25.00.');
+ expect(statusText.props.style).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ color: '#F44336' })
+ ])
+ );
+ });
+ });
+
+ it('should apply green color when user is owed money', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ const mockSettlements = [
+ { fromUserId: 'user456', toUserId: 'user123', amount: 25 },
+ ];
+
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const statusText = getByText('You are owed $25.00.');
+ expect(statusText.props.style).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ color: '#4CAF50' })
+ ])
+ );
+ });
+ });
+
+ it('should apply default green color for calculating status', async () => {
+ const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
+ getGroups.mockResolvedValue({ data: { groups: mockGroups } });
+ // Don't resolve settlements to keep it in calculating state
+
+ const { getByText } = renderWithAuthContext();
+
+ await waitFor(() => {
+ const statusText = getByText('Calculating balances...');
+ expect(statusText.props.style).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ color: '#4CAF50' })
+ ])
+ );
+ });
+ });
+ });
+
+ describe('Component Lifecycle', () => {
+ it('should fetch groups when token changes from null to valid', async () => {
+ const { rerender } = render(
+
+
+
+ );
+
+ expect(getGroups).not.toHaveBeenCalled();
+
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ rerender(
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(getGroups).toHaveBeenCalledWith('mock-token-123');
+ });
+ });
+
+ it('should not refetch groups when token changes to same value', async () => {
+ getGroups.mockResolvedValue({ data: { groups: [] } });
+
+ const { rerender } = renderWithAuthContext();
+
+ await waitFor(() => {
+ expect(getGroups).toHaveBeenCalledTimes(1);
+ });
+
+ // Re-render with same token
+ rerender(
+
+
+
+ );
+
+ // Should not call again
+ expect(getGroups).toHaveBeenCalledTimes(1);
+ });
+ });
+});
\ No newline at end of file
diff --git a/frontend/utils/balanceCalculator.test.js b/frontend/utils/balanceCalculator.test.js
new file mode 100644
index 00000000..138fc7d5
--- /dev/null
+++ b/frontend/utils/balanceCalculator.test.js
@@ -0,0 +1,815 @@
+/**
+ * Comprehensive unit tests for balanceCalculator utility functions
+ * Testing framework: Jest (based on ES6 modules and common Node.js patterns)
+ */
+
+import balanceCalculatorModule, { calculateFriendBalances, safeGet, validateGroupData, getMemberName } from './balanceCalculator';
+
+describe('balanceCalculator', () => {
+ describe('safeGet', () => {
+ it('should return value for valid path', () => {
+ const obj = { user: { name: 'John', age: 30 } };
+ expect(safeGet(obj, 'user.name')).toBe('John');
+ expect(safeGet(obj, 'user.age')).toBe(30);
+ });
+
+ it('should return default value for invalid path', () => {
+ const obj = { user: { name: 'John' } };
+ expect(safeGet(obj, 'user.email', 'default')).toBe('default');
+ expect(safeGet(obj, 'nonexistent.path', 'fallback')).toBe('fallback');
+ });
+
+ it('should return null as default when no default value provided', () => {
+ const obj = { user: { name: 'John' } };
+ expect(safeGet(obj, 'user.email')).toBeNull();
+ });
+
+ it('should handle null/undefined objects gracefully', () => {
+ expect(safeGet(null, 'any.path', 'default')).toBe('default');
+ expect(safeGet(undefined, 'any.path', 'default')).toBe('default');
+ expect(safeGet('not an object', 'any.path', 'default')).toBe('default');
+ expect(safeGet(123, 'any.path', 'default')).toBe('default');
+ expect(safeGet(true, 'any.path', 'default')).toBe('default');
+ });
+
+ it('should handle empty path', () => {
+ const obj = { value: 'test' };
+ expect(safeGet(obj, '', 'default')).toBe('default');
+ });
+
+ it('should handle null/undefined values in path', () => {
+ const obj = { user: null };
+ expect(safeGet(obj, 'user.name', 'default')).toBe('default');
+
+ const obj2 = { user: { profile: undefined } };
+ expect(safeGet(obj2, 'user.profile.name', 'default')).toBe('default');
+ });
+
+ it('should handle deep nested paths', () => {
+ const obj = { a: { b: { c: { d: { e: 'deep value' } } } } };
+ expect(safeGet(obj, 'a.b.c.d.e')).toBe('deep value');
+ expect(safeGet(obj, 'a.b.c.d.f', 'missing')).toBe('missing');
+ });
+
+ it('should handle array indices in path', () => {
+ const obj = { items: [{ name: 'first' }, { name: 'second' }] };
+ expect(safeGet(obj, 'items.0.name')).toBe('first');
+ expect(safeGet(obj, 'items.1.name')).toBe('second');
+ expect(safeGet(obj, 'items.2.name', 'not found')).toBe('not found');
+ });
+
+ it('should return default value when final value is null or undefined', () => {
+ const obj = { user: { name: null, email: undefined } };
+ expect(safeGet(obj, 'user.name', 'default')).toBe('default');
+ expect(safeGet(obj, 'user.email', 'default')).toBe('default');
+ });
+
+ it('should handle non-object intermediate values', () => {
+ const obj = { user: 'string value' };
+ expect(safeGet(obj, 'user.name', 'default')).toBe('default');
+
+ const obj2 = { user: { profile: 123 } };
+ expect(safeGet(obj2, 'user.profile.name', 'default')).toBe('default');
+ });
+
+ it('should handle boolean values correctly', () => {
+ const obj = { settings: { enabled: false, debug: true } };
+ expect(safeGet(obj, 'settings.enabled')).toBe(false);
+ expect(safeGet(obj, 'settings.debug')).toBe(true);
+ });
+
+ it('should handle zero values correctly', () => {
+ const obj = { count: 0, balance: 0.0 };
+ expect(safeGet(obj, 'count')).toBe(0);
+ expect(safeGet(obj, 'balance')).toBe(0.0);
+ });
+ });
+
+ describe('validateGroupData', () => {
+ const validGroupData = {
+ id: 'group123',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'User One' } }] },
+ { data: { expenses: [{ id: 'exp1', amount: 100 }] } }
+ ]
+ };
+
+ it('should validate and return correct group data', () => {
+ const result = validateGroupData(validGroupData);
+ expect(result).toEqual({
+ id: 'group123',
+ name: 'Test Group',
+ members: [{ userId: 'user1', user: { name: 'User One' } }],
+ expenses: [{ id: 'exp1', amount: 100 }]
+ });
+ });
+
+ it('should return null for null/undefined input', () => {
+ expect(validateGroupData(null)).toBeNull();
+ expect(validateGroupData(undefined)).toBeNull();
+ expect(validateGroupData('not an object')).toBeNull();
+ expect(validateGroupData(123)).toBeNull();
+ expect(validateGroupData([])).toBeNull();
+ });
+
+ it('should return null when details is not an array', () => {
+ const invalidGroup = { ...validGroupData, details: null };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const invalidGroup2 = { ...validGroupData, details: 'not an array' };
+ expect(validateGroupData(invalidGroup2)).toBeNull();
+
+ const invalidGroup3 = { ...validGroupData, details: {} };
+ expect(validateGroupData(invalidGroup3)).toBeNull();
+ });
+
+ it('should return null when details has less than 2 elements', () => {
+ const invalidGroup = { ...validGroupData, details: [{ data: [] }] };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const emptyDetails = { ...validGroupData, details: [] };
+ expect(validateGroupData(emptyDetails)).toBeNull();
+ });
+
+ it('should return null when members data is not an array', () => {
+ const invalidGroup = {
+ ...validGroupData,
+ details: [
+ { data: 'not an array' },
+ { data: { expenses: [] } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const invalidGroup2 = {
+ ...validGroupData,
+ details: [
+ { data: null },
+ { data: { expenses: [] } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup2)).toBeNull();
+ });
+
+ it('should return null when expenses data is not an array', () => {
+ const invalidGroup = {
+ ...validGroupData,
+ details: [
+ { data: [] },
+ { data: { expenses: 'not an array' } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const invalidGroup2 = {
+ ...validGroupData,
+ details: [
+ { data: [] },
+ { data: { expenses: null } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup2)).toBeNull();
+ });
+
+ it('should handle missing members response data', () => {
+ const invalidGroup = {
+ ...validGroupData,
+ details: [
+ { notData: [] },
+ { data: { expenses: [] } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const invalidGroup2 = {
+ ...validGroupData,
+ details: [
+ {},
+ { data: { expenses: [] } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup2)).toBeNull();
+ });
+
+ it('should handle missing expenses response data', () => {
+ const invalidGroup = {
+ ...validGroupData,
+ details: [
+ { data: [] },
+ { data: { notExpenses: [] } }
+ ]
+ };
+ expect(validateGroupData(invalidGroup)).toBeNull();
+
+ const invalidGroup2 = {
+ ...validGroupData,
+ details: [
+ { data: [] },
+ { data: {} }
+ ]
+ };
+ expect(validateGroupData(invalidGroup2)).toBeNull();
+ });
+
+ it('should use _id as fallback when id is missing', () => {
+ const groupWithUnderscore = {
+ ...validGroupData,
+ _id: 'group456'
+ };
+ delete groupWithUnderscore.id;
+
+ const result = validateGroupData(groupWithUnderscore);
+ expect(result.id).toBe('group456');
+ });
+
+ it('should use default name when name is missing', () => {
+ const groupWithoutName = { ...validGroupData };
+ delete groupWithoutName.name;
+
+ const result = validateGroupData(groupWithoutName);
+ expect(result.name).toBe('Unknown Group');
+ });
+
+ it('should handle missing details property', () => {
+ const groupWithoutDetails = { id: 'group1', name: 'Test' };
+ expect(validateGroupData(groupWithoutDetails)).toBeNull();
+ });
+
+ it('should handle empty members and expenses arrays', () => {
+ const groupWithEmptyArrays = {
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [] },
+ { data: { expenses: [] } }
+ ]
+ };
+
+ const result = validateGroupData(groupWithEmptyArrays);
+ expect(result).toEqual({
+ id: 'group1',
+ name: 'Test Group',
+ members: [],
+ expenses: []
+ });
+ });
+ });
+
+ describe('getMemberName', () => {
+ const members = [
+ { userId: 'user1', user: { name: 'Alice' } },
+ { userId: 'user2', user: { name: 'Bob' } },
+ { userId: 'user3', user: { name: null } },
+ { userId: 'user4' }, // Missing user object
+ { userId: 'user5', user: {} }, // Empty user object
+ { userId: 'user6', user: { name: '' } } // Empty name
+ ];
+
+ it('should return correct member name', () => {
+ expect(getMemberName(members, 'user1')).toBe('Alice');
+ expect(getMemberName(members, 'user2')).toBe('Bob');
+ });
+
+ it('should return "Unknown" for non-existent userId', () => {
+ expect(getMemberName(members, 'nonexistent')).toBe('Unknown');
+ });
+
+ it('should return "Unknown" for null/undefined userId', () => {
+ expect(getMemberName(members, null)).toBe('Unknown');
+ expect(getMemberName(members, undefined)).toBe('Unknown');
+ expect(getMemberName(members, '')).toBe('Unknown');
+ });
+
+ it('should return "Unknown" for invalid members array', () => {
+ expect(getMemberName(null, 'user1')).toBe('Unknown');
+ expect(getMemberName(undefined, 'user1')).toBe('Unknown');
+ expect(getMemberName('not an array', 'user1')).toBe('Unknown');
+ expect(getMemberName({}, 'user1')).toBe('Unknown');
+ expect(getMemberName(123, 'user1')).toBe('Unknown');
+ });
+
+ it('should return "Unknown" when member has no name', () => {
+ expect(getMemberName(members, 'user3')).toBe('Unknown');
+ expect(getMemberName(members, 'user4')).toBe('Unknown');
+ expect(getMemberName(members, 'user5')).toBe('Unknown');
+ });
+
+ it('should return "Unknown" for empty name', () => {
+ expect(getMemberName(members, 'user6')).toBe('Unknown');
+ });
+
+ it('should handle empty members array', () => {
+ expect(getMemberName([], 'user1')).toBe('Unknown');
+ });
+
+ it('should handle members with invalid structure', () => {
+ const invalidMembers = [
+ null,
+ 'invalid member',
+ { userId: 'user1' },
+ { user: { name: 'No UserId' } }
+ ];
+
+ expect(getMemberName(invalidMembers, 'user1')).toBe('Unknown');
+ expect(getMemberName(invalidMembers, 'nonexistent')).toBe('Unknown');
+ });
+ });
+
+ describe('calculateFriendBalances', () => {
+ const mockGroupsWithDetails = [
+ {
+ id: 'group1',
+ name: 'Test Group 1',
+ details: [
+ {
+ data: [
+ { userId: 'user1', user: { name: 'Alice' } },
+ { userId: 'user2', user: { name: 'Bob' } },
+ { userId: 'currentUser', user: { name: 'Current User' } }
+ ]
+ },
+ {
+ data: {
+ expenses: [
+ {
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ { userId: 'user1', amount: 50 },
+ { userId: 'user2', amount: 30 }
+ ]
+ },
+ {
+ id: 'exp2',
+ paidBy: 'user1',
+ splits: [
+ { userId: 'currentUser', amount: 20 }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ];
+
+ it('should calculate balances correctly when current user paid', () => {
+ const result = calculateFriendBalances(mockGroupsWithDetails, 'currentUser');
+
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+ const bobBalance = result.find(friend => friend.id === 'user2');
+
+ expect(aliceBalance).toBeDefined();
+ expect(aliceBalance.netBalance).toBe(30); // owes 50 from exp1, paid 20 for currentUser in exp2
+ expect(aliceBalance.groups[0].balance).toBe(30);
+
+ expect(bobBalance).toBeDefined();
+ expect(bobBalance.netBalance).toBe(30); // owes 30 from exp1
+ expect(bobBalance.groups[0].balance).toBe(30);
+ });
+
+ it('should handle invalid input gracefully', () => {
+ expect(calculateFriendBalances(null, 'currentUser')).toEqual([]);
+ expect(calculateFriendBalances(undefined, 'currentUser')).toEqual([]);
+ expect(calculateFriendBalances([], null)).toEqual([]);
+ expect(calculateFriendBalances([], undefined)).toEqual([]);
+ expect(calculateFriendBalances('not an array', 'currentUser')).toEqual([]);
+ expect(calculateFriendBalances({}, 'currentUser')).toEqual([]);
+ expect(calculateFriendBalances([], '')).toEqual([]);
+ });
+
+ it('should skip invalid group data', () => {
+ const invalidGroups = [
+ null,
+ { invalid: 'group' },
+ { details: [] },
+ 'invalid group',
+ 123
+ ];
+
+ const result = calculateFriendBalances(invalidGroups, 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should handle expenses with createdBy fallback', () => {
+ const groupsWithCreatedBy = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ createdBy: 'currentUser', // No paidBy field
+ splits: [{ userId: 'user1', amount: 50 }]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(groupsWithCreatedBy, 'currentUser');
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+
+ expect(aliceBalance.netBalance).toBe(50);
+ });
+
+ it('should handle zero and negative amounts', () => {
+ const groupsWithZeroAmounts = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ { userId: 'user1', amount: 0 },
+ { userId: 'user1', amount: -10 },
+ { userId: 'user1', amount: 'invalid' },
+ { userId: 'user1', amount: NaN },
+ { userId: 'user1', amount: null }
+ ]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(groupsWithZeroAmounts, 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should not create balance entries when payer owes themselves', () => {
+ const selfPayingGroups = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'currentUser', user: { name: 'Current User' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [{ userId: 'currentUser', amount: 50 }]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(selfPayingGroups, 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should handle multiple groups correctly', () => {
+ const multipleGroups = [
+ {
+ id: 'group1',
+ name: 'Group 1',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [{ userId: 'user1', amount: 30 }]
+ }]
+ }
+ }
+ ]
+ },
+ {
+ id: 'group2',
+ name: 'Group 2',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp2',
+ paidBy: 'currentUser',
+ splits: [{ userId: 'user1', amount: 20 }]
+ }]
+ }
+ }
+ ]
+ }
+ ];
+
+ const result = calculateFriendBalances(multipleGroups, 'currentUser');
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+
+ expect(aliceBalance.netBalance).toBe(50); // 30 + 20
+ expect(aliceBalance.groups).toHaveLength(2);
+ expect(aliceBalance.groups.find(g => g.id === 'group1').balance).toBe(30);
+ expect(aliceBalance.groups.find(g => g.id === 'group2').balance).toBe(20);
+ });
+
+ it('should handle missing or invalid expense data', () => {
+ const invalidExpenseGroups = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [] },
+ {
+ data: {
+ expenses: [
+ null,
+ { id: 'exp1' }, // Missing required fields
+ { id: 'exp2', paidBy: 'user1' }, // Missing splits
+ { id: 'exp3', splits: [] }, // Missing paidBy
+ 'invalid expense',
+ { id: 'exp4', paidBy: '', splits: [] }, // Empty paidBy
+ { id: 'exp5', paidBy: null, splits: [{ userId: 'user1', amount: 50 }] }
+ ]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(invalidExpenseGroups, 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should handle missing split data', () => {
+ const invalidSplitGroups = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ null,
+ 'invalid split',
+ { userId: 'user1' }, // Missing amount
+ { amount: 50 }, // Missing userId
+ { userId: '', amount: 30 }, // Empty userId
+ { userId: null, amount: 25 }, // Null userId
+ { userId: 'user1', amount: undefined } // Undefined amount
+ ]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(invalidSplitGroups, 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should log warnings for invalid input', () => {
+ const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
+
+ calculateFriendBalances(null, 'currentUser');
+ expect(consoleSpy).toHaveBeenCalledWith('Invalid input to calculateFriendBalances:', { groupsWithDetails: null, currentUserId: 'currentUser' });
+
+ calculateFriendBalances([], null);
+ expect(consoleSpy).toHaveBeenCalledWith('Invalid input to calculateFriendBalances:', { groupsWithDetails: [], currentUserId: null });
+
+ consoleSpy.mockRestore();
+ });
+
+ it('should log warnings for invalid group data', () => {
+ const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
+
+ const invalidGroup = { invalid: 'data' };
+ calculateFriendBalances([invalidGroup], 'currentUser');
+ expect(consoleSpy).toHaveBeenCalledWith('Invalid group data, skipping:', invalidGroup);
+
+ consoleSpy.mockRestore();
+ });
+
+ it('should format output correctly for UI consumption', () => {
+ const result = calculateFriendBalances(mockGroupsWithDetails, 'currentUser');
+
+ expect(Array.isArray(result)).toBe(true);
+ result.forEach(friend => {
+ expect(friend).toHaveProperty('id');
+ expect(friend).toHaveProperty('name');
+ expect(friend).toHaveProperty('netBalance');
+ expect(friend).toHaveProperty('groups');
+ expect(Array.isArray(friend.groups)).toBe(true);
+ expect(typeof friend.netBalance).toBe('number');
+ expect(friend.id).toBeTruthy();
+
+ friend.groups.forEach(group => {
+ expect(group).toHaveProperty('id');
+ expect(group).toHaveProperty('name');
+ expect(group).toHaveProperty('balance');
+ expect(typeof group.balance).toBe('number');
+ expect(group.id).toBeTruthy();
+ });
+ });
+ });
+
+ it('should handle complex balance calculations across multiple expenses', () => {
+ const complexGroups = [{
+ id: 'group1',
+ name: 'Complex Group',
+ details: [
+ {
+ data: [
+ { userId: 'user1', user: { name: 'Alice' } },
+ { userId: 'user2', user: { name: 'Bob' } },
+ { userId: 'currentUser', user: { name: 'Current User' } }
+ ]
+ },
+ {
+ data: {
+ expenses: [
+ {
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ { userId: 'user1', amount: 50 },
+ { userId: 'user2', amount: 30 }
+ ]
+ },
+ {
+ id: 'exp2',
+ paidBy: 'user1',
+ splits: [
+ { userId: 'currentUser', amount: 40 },
+ { userId: 'user2', amount: 20 }
+ ]
+ },
+ {
+ id: 'exp3',
+ paidBy: 'user2',
+ splits: [
+ { userId: 'currentUser', amount: 15 },
+ { userId: 'user1', amount: 25 }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(complexGroups, 'currentUser');
+
+ // Alice: owes 50 from exp1, gets 40 from exp2 = net 10 (Alice owes currentUser)
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+ expect(aliceBalance?.netBalance).toBe(10); // 50 - 40 = 10
+
+ // Bob: owes 30 from exp1, owes 20 from exp2, gets 15 from exp3 = net 35 (Bob owes currentUser)
+ const bobBalance = result.find(friend => friend.id === 'user2');
+ expect(bobBalance?.netBalance).toBe(35); // 30 + 20 - 15 = 35
+ });
+
+ it('should handle string amounts by parsing them', () => {
+ const groupsWithStringAmounts = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ { userId: 'user1', amount: '50.75' },
+ { userId: 'user1', amount: '25.25' }
+ ]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(groupsWithStringAmounts, 'currentUser');
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+
+ expect(aliceBalance?.netBalance).toBe(76); // 50.75 + 25.25
+ });
+
+ it('should handle decimal amounts correctly', () => {
+ const groupsWithDecimals = [{
+ id: 'group1',
+ name: 'Test Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ {
+ data: {
+ expenses: [{
+ id: 'exp1',
+ paidBy: 'currentUser',
+ splits: [
+ { userId: 'user1', amount: 33.33 },
+ { userId: 'user1', amount: 16.67 }
+ ]
+ }]
+ }
+ }
+ ]
+ }];
+
+ const result = calculateFriendBalances(groupsWithDecimals, 'currentUser');
+ const aliceBalance = result.find(friend => friend.id === 'user1');
+
+ expect(aliceBalance?.netBalance).toBe(50); // 33.33 + 16.67
+ });
+
+ it('should handle empty groups array', () => {
+ const result = calculateFriendBalances([], 'currentUser');
+ expect(result).toEqual([]);
+ });
+
+ it('should handle groups with no expenses', () => {
+ const groupsWithNoExpenses = [{
+ id: 'group1',
+ name: 'Empty Group',
+ details: [
+ { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
+ { data: { expenses: [] } }
+ ]
+ }];
+
+ const result = calculateFriendBalances(groupsWithNoExpenses, 'currentUser');
+ expect(result).toEqual([]);
+ });
+ });
+
+ describe('default export', () => {
+ it('should export all functions in default object', () => {
+ expect(balanceCalculatorModule).toHaveProperty('calculateFriendBalances');
+ expect(balanceCalculatorModule).toHaveProperty('safeGet');
+ expect(balanceCalculatorModule).toHaveProperty('validateGroupData');
+ expect(balanceCalculatorModule).toHaveProperty('getMemberName');
+ });
+
+ it('should have working functions in default export', () => {
+ const obj = { test: { value: 'works' } };
+ expect(balanceCalculatorModule.safeGet(obj, 'test.value')).toBe('works');
+ });
+ });
+
+ describe('edge cases and error handling', () => {
+ it('should handle circular references gracefully', () => {
+ const circularObj = {};
+ circularObj.self = circularObj;
+
+ expect(safeGet(circularObj, 'self.self.self', 'default')).toBe('default');
+ });
+
+ it('should handle very deep nesting', () => {
+ const deepObj = { level1: { level2: { level3: { level4: { level5: 'deep' } } } } };
+ expect(safeGet(deepObj, 'level1.level2.level3.level4.level5')).toBe('deep');
+ expect(safeGet(deepObj, 'level1.level2.level3.level4.level6', 'not found')).toBe('not found');
+ });
+
+ it('should handle special characters in object keys', () => {
+ const specialObj = { 'key-with-dash': { 'key.with.dots': 'value' } };
+ expect(safeGet(specialObj, 'key-with-dash.key.with.dots')).toBe('value');
+ });
+
+ it('should handle numeric string keys', () => {
+ const numericObj = { '123': { '456': 'numeric keys' } };
+ expect(safeGet(numericObj, '123.456')).toBe('numeric keys');
+ });
+
+ it('should handle prototype pollution attempts', () => {
+ const maliciousObj = { '__proto__': { polluted: 'value' } };
+ expect(safeGet(maliciousObj, '__proto__.polluted')).toBe('value');
+ expect(safeGet({}, 'polluted', 'safe')).toBe('safe'); // Should not be polluted
+ });
+
+ it('should handle large datasets without performance issues', () => {
+ const largeGroups = Array.from({ length: 100 }, (_, i) => ({
+ id: `group${i}`,
+ name: `Group ${i}`,
+ details: [
+ { data: Array.from({ length: 50 }, (_, j) => ({ userId: `user${j}`, user: { name: `User ${j}` } })) },
+ {
+ data: {
+ expenses: Array.from({ length: 100 }, (_, k) => ({
+ id: `exp${k}`,
+ paidBy: 'currentUser',
+ splits: [{ userId: `user${k % 50}`, amount: Math.random() * 100 }]
+ }))
+ }
+ }
+ ]
+ }));
+
+ const startTime = Date.now();
+ const result = calculateFriendBalances(largeGroups, 'currentUser');
+ const endTime = Date.now();
+
+ expect(endTime - startTime).toBeLessThan(5000); // Should complete within 5 seconds
+ expect(Array.isArray(result)).toBe(true);
+ });
+ });
+});
\ No newline at end of file
From 2da0356753832f6f670de8d025077b00e826387f Mon Sep 17 00:00:00 2001
From: "patel.devasy.23"
Date: Mon, 4 Aug 2025 16:08:19 +0000
Subject: [PATCH 5/5] =?UTF-8?q?Revert=20"=F0=9F=93=9D=20CodeRabbit=20Chat:?=
=?UTF-8?q?=20Add=20comprehensive=20Jest=20unit=20tests=20for=20API,=20uti?=
=?UTF-8?q?ls,=20and=20screen=20components"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit df450737195a378b806b9924c14e90d120707610.
---
frontend/api/groups.test.js | 901 ----------------
frontend/babel.config.js | 13 -
frontend/jest.setup.js | 26 -
frontend/package.json | 36 +-
frontend/screens/FriendsScreen.test.js | 597 ----------
frontend/screens/GroupDetailsScreen.test.js | 1078 -------------------
frontend/screens/HomeScreen.js | 4 +-
frontend/screens/HomeScreen.test.js | 851 ---------------
frontend/utils/balanceCalculator.test.js | 815 --------------
9 files changed, 5 insertions(+), 4316 deletions(-)
delete mode 100644 frontend/api/groups.test.js
delete mode 100644 frontend/babel.config.js
delete mode 100644 frontend/jest.setup.js
delete mode 100644 frontend/screens/FriendsScreen.test.js
delete mode 100644 frontend/screens/GroupDetailsScreen.test.js
delete mode 100644 frontend/screens/HomeScreen.test.js
delete mode 100644 frontend/utils/balanceCalculator.test.js
diff --git a/frontend/api/groups.test.js b/frontend/api/groups.test.js
deleted file mode 100644
index da4c48e3..00000000
--- a/frontend/api/groups.test.js
+++ /dev/null
@@ -1,901 +0,0 @@
-import axios from 'axios';
-import {
- getGroups,
- getOptimizedSettlements,
- createExpense,
- getGroupDetails,
- getGroupMembers,
- getGroupExpenses,
- createGroup,
- joinGroup,
- getUserBalanceSummary,
- getFriendsBalance
-} from './groups';
-
-// Mock axios
-jest.mock('axios');
-const mockedAxios = axios;
-
-describe('Groups API', () => {
- let mockApiClient;
-
- beforeEach(() => {
- // Reset all mocks before each test
- jest.clearAllMocks();
-
- // Create a mock API client
- mockApiClient = {
- get: jest.fn(),
- post: jest.fn()
- };
-
- // Mock axios.create to return our mock client
- mockedAxios.create.mockReturnValue(mockApiClient);
- });
-
- describe('API Client Configuration', () => {
- test('should create axios instance with correct base URL and headers', () => {
- // Import the module to trigger axios.create
- require('./groups');
-
- expect(mockedAxios.create).toHaveBeenCalledWith({
- baseURL: 'https://splitwiser-production.up.railway.app',
- headers: {
- 'Content-Type': 'application/json',
- },
- });
- });
- });
-
- describe('getGroups', () => {
- test('should fetch groups with valid token', async () => {
- const mockToken = 'valid-token-123';
- const mockResponse = { data: [{ id: 1, name: 'Test Group' }] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- });
- expect(result).toBe(mockResponse);
- });
-
- test('should handle empty token', async () => {
- const mockToken = '';
- const mockResponse = { data: [] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: 'Bearer ',
- },
- });
- });
-
- test('should handle null token', async () => {
- const mockToken = null;
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: 'Bearer null',
- },
- });
- });
-
- test('should handle undefined token', async () => {
- const mockToken = undefined;
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: 'Bearer undefined',
- },
- });
- });
-
- test('should handle API error', async () => {
- const mockToken = 'valid-token';
- const mockError = new Error('Network Error');
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toThrow('Network Error');
- });
-
- test('should handle 401 unauthorized error', async () => {
- const mockToken = 'invalid-token';
- const mockError = { response: { status: 401, data: { message: 'Unauthorized' } } };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toEqual(mockError);
- });
- });
-
- describe('getOptimizedSettlements', () => {
- test('should fetch optimized settlements with valid parameters', async () => {
- const mockToken = 'valid-token-123';
- const mockGroupId = 'group-123';
- const mockResponse = { data: { settlements: [] } };
- mockApiClient.post.mockResolvedValue(mockResponse);
-
- const result = await getOptimizedSettlements(mockToken, mockGroupId);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/settlements/optimize`,
- {},
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle numeric group ID', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 123;
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await getOptimizedSettlements(mockToken, mockGroupId);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups/123/settlements/optimize',
- {},
- expect.any(Object)
- );
- });
-
- test('should handle special characters in group ID', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-with-special-chars@#$';
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await getOptimizedSettlements(mockToken, mockGroupId);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups/group-with-special-chars@#$/settlements/optimize',
- {},
- expect.any(Object)
- );
- });
-
- test('should handle API error for settlements', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockError = new Error('Settlement calculation failed');
- mockApiClient.post.mockRejectedValue(mockError);
-
- await expect(getOptimizedSettlements(mockToken, mockGroupId)).rejects.toThrow(
- 'Settlement calculation failed'
- );
- });
- });
-
- describe('createExpense', () => {
- test('should create expense with valid data', async () => {
- const mockToken = 'valid-token-123';
- const mockGroupId = 'group-123';
- const mockExpenseData = {
- description: 'Dinner',
- amount: 50.25,
- paidBy: 'user-123',
- splitBetween: ['user-123', 'user-456']
- };
- const mockResponse = { data: { id: 'expense-123', ...mockExpenseData } };
- mockApiClient.post.mockResolvedValue(mockResponse);
-
- const result = await createExpense(mockToken, mockGroupId, mockExpenseData);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/expenses`,
- mockExpenseData,
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle empty expense data', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockExpenseData = {};
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createExpense(mockToken, mockGroupId, mockExpenseData);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/expenses`,
- {},
- expect.any(Object)
- );
- });
-
- test('should handle null expense data', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockExpenseData = null;
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createExpense(mockToken, mockGroupId, mockExpenseData);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/expenses`,
- null,
- expect.any(Object)
- );
- });
-
- test('should handle large expense amounts', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockExpenseData = { amount: 999999.99 };
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createExpense(mockToken, mockGroupId, mockExpenseData);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- expect.any(String),
- mockExpenseData,
- expect.any(Object)
- );
- });
-
- test('should handle negative expense amounts', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockExpenseData = { amount: -50.00 };
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createExpense(mockToken, mockGroupId, mockExpenseData);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- expect.any(String),
- mockExpenseData,
- expect.any(Object)
- );
- });
- });
-
- describe('getGroupDetails', () => {
- test('should fetch both group members and expenses', async () => {
- const mockToken = 'valid-token-123';
- const mockGroupId = 'group-123';
- const mockMembersResponse = { data: [{ id: 'user-1', name: 'John' }] };
- const mockExpensesResponse = { data: [{ id: 'expense-1', amount: 50 }] };
-
- mockApiClient.get
- .mockResolvedValueOnce(mockMembersResponse)
- .mockResolvedValueOnce(mockExpensesResponse);
-
- const result = await getGroupDetails(mockToken, mockGroupId);
-
- expect(result).toEqual([mockMembersResponse, mockExpensesResponse]);
- expect(mockApiClient.get).toHaveBeenCalledTimes(2);
- expect(mockApiClient.get).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/members`,
- expect.any(Object)
- );
- expect(mockApiClient.get).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/expenses`,
- expect.any(Object)
- );
- });
-
- test('should handle when one API call fails', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockMembersResponse = { data: [] };
- const mockError = new Error('Expenses fetch failed');
-
- mockApiClient.get
- .mockResolvedValueOnce(mockMembersResponse)
- .mockRejectedValueOnce(mockError);
-
- await expect(getGroupDetails(mockToken, mockGroupId)).rejects.toThrow(
- 'Expenses fetch failed'
- );
- });
-
- test('should handle when both API calls fail', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
- const mockError1 = new Error('Members fetch failed');
- const mockError2 = new Error('Expenses fetch failed');
-
- mockApiClient.get
- .mockRejectedValueOnce(mockError1)
- .mockRejectedValueOnce(mockError2);
-
- await expect(getGroupDetails(mockToken, mockGroupId)).rejects.toThrow(
- 'Members fetch failed'
- );
- });
- });
-
- describe('getGroupMembers', () => {
- test('should fetch group members with valid parameters', async () => {
- const mockToken = 'valid-token-123';
- const mockGroupId = 'group-123';
- const mockResponse = { data: [{ id: 'user-1', name: 'John Doe' }] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroupMembers(mockToken, mockGroupId);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/members`,
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle empty members list', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'empty-group';
- const mockResponse = { data: [] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroupMembers(mockToken, mockGroupId);
-
- expect(result.data).toEqual([]);
- });
- });
-
- describe('getGroupExpenses', () => {
- test('should fetch group expenses with valid parameters', async () => {
- const mockToken = 'valid-token-123';
- const mockGroupId = 'group-123';
- const mockResponse = {
- data: [
- { id: 'expense-1', description: 'Lunch', amount: 25.50 },
- { id: 'expense-2', description: 'Dinner', amount: 40.00 }
- ]
- };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroupExpenses(mockToken, mockGroupId);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- `/groups/${mockGroupId}/expenses`,
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle group with no expenses', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'new-group';
- const mockResponse = { data: [] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroupExpenses(mockToken, mockGroupId);
-
- expect(result.data).toEqual([]);
- });
- });
-
- describe('createGroup', () => {
- test('should create group with valid name', async () => {
- const mockToken = 'valid-token-123';
- const mockName = 'My Awesome Group';
- const mockResponse = { data: { id: 'group-123', name: mockName } };
- mockApiClient.post.mockResolvedValue(mockResponse);
-
- const result = await createGroup(mockToken, mockName);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups',
- { name: mockName },
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle empty group name', async () => {
- const mockToken = 'valid-token';
- const mockName = '';
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createGroup(mockToken, mockName);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups',
- { name: '' },
- expect.any(Object)
- );
- });
-
- test('should handle very long group name', async () => {
- const mockToken = 'valid-token';
- const mockName = 'A'.repeat(1000);
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createGroup(mockToken, mockName);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups',
- { name: mockName },
- expect.any(Object)
- );
- });
-
- test('should handle special characters in group name', async () => {
- const mockToken = 'valid-token';
- const mockName = 'Group @#$%^&*()_+-={}[]|\\:";\'<>?,./';
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createGroup(mockToken, mockName);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups',
- { name: mockName },
- expect.any(Object)
- );
- });
-
- test('should handle unicode characters in group name', async () => {
- const mockToken = 'valid-token';
- const mockName = '🎉 Party Group 🎊';
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await createGroup(mockToken, mockName);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups',
- { name: mockName },
- expect.any(Object)
- );
- });
- });
-
- describe('joinGroup', () => {
- test('should join group with valid join code', async () => {
- const mockToken = 'valid-token-123';
- const mockJoinCode = 'ABC123XYZ';
- const mockResponse = { data: { groupId: 'group-123', message: 'Joined successfully' } };
- mockApiClient.post.mockResolvedValue(mockResponse);
-
- const result = await joinGroup(mockToken, mockJoinCode);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups/join',
- { joinCode: mockJoinCode },
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle invalid join code', async () => {
- const mockToken = 'valid-token';
- const mockJoinCode = 'INVALID';
- const mockError = { response: { status: 404, data: { message: 'Group not found' } } };
- mockApiClient.post.mockRejectedValue(mockError);
-
- await expect(joinGroup(mockToken, mockJoinCode)).rejects.toEqual(mockError);
- });
-
- test('should handle empty join code', async () => {
- const mockToken = 'valid-token';
- const mockJoinCode = '';
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await joinGroup(mockToken, mockJoinCode);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups/join',
- { joinCode: '' },
- expect.any(Object)
- );
- });
-
- test('should handle null join code', async () => {
- const mockToken = 'valid-token';
- const mockJoinCode = null;
- mockApiClient.post.mockResolvedValue({ data: {} });
-
- await joinGroup(mockToken, mockJoinCode);
-
- expect(mockApiClient.post).toHaveBeenCalledWith(
- '/groups/join',
- { joinCode: null },
- expect.any(Object)
- );
- });
-
- test('should handle expired join code', async () => {
- const mockToken = 'valid-token';
- const mockJoinCode = 'EXPIRED123';
- const mockError = { response: { status: 410, data: { message: 'Join code expired' } } };
- mockApiClient.post.mockRejectedValue(mockError);
-
- await expect(joinGroup(mockToken, mockJoinCode)).rejects.toEqual(mockError);
- });
- });
-
- describe('getUserBalanceSummary', () => {
- test('should fetch user balance summary with valid token', async () => {
- const mockToken = 'valid-token-123';
- const mockResponse = {
- data: {
- totalOwed: 150.75,
- totalOwing: 75.25,
- netBalance: 75.50
- }
- };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getUserBalanceSummary(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- '/users/me/balance-summary',
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle user with no balance data', async () => {
- const mockToken = 'valid-token';
- const mockResponse = {
- data: {
- totalOwed: 0,
- totalOwing: 0,
- netBalance: 0
- }
- };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getUserBalanceSummary(mockToken);
-
- expect(result.data.netBalance).toBe(0);
- });
-
- test('should handle API error for balance summary', async () => {
- const mockToken = 'valid-token';
- const mockError = new Error('Balance calculation error');
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getUserBalanceSummary(mockToken)).rejects.toThrow(
- 'Balance calculation error'
- );
- });
- });
-
- describe('getFriendsBalance', () => {
- test('should fetch friends balance with valid token', async () => {
- const mockToken = 'valid-token-123';
- const mockResponse = {
- data: [
- { friendId: 'user-456', name: 'Alice', balance: 25.50 },
- { friendId: 'user-789', name: 'Bob', balance: -15.25 }
- ]
- };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getFriendsBalance(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- '/users/me/friends-balance',
- {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- }
- );
- expect(result).toBe(mockResponse);
- });
-
- test('should handle user with no friends', async () => {
- const mockToken = 'valid-token';
- const mockResponse = { data: [] };
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getFriendsBalance(mockToken);
-
- expect(result.data).toEqual([]);
- });
-
- test('should handle API error for friends balance', async () => {
- const mockToken = 'valid-token';
- const mockError = { response: { status: 500, data: { message: 'Internal server error' } } };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getFriendsBalance(mockToken)).rejects.toEqual(mockError);
- });
- });
-
- describe('Error Handling', () => {
- test('should handle network timeouts', async () => {
- const mockToken = 'valid-token';
- const mockError = { code: 'ECONNABORTED', message: 'timeout of 5000ms exceeded' };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toEqual(mockError);
- });
-
- test('should handle connection refused', async () => {
- const mockToken = 'valid-token';
- const mockError = { code: 'ECONNREFUSED', message: 'connect ECONNREFUSED' };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toEqual(mockError);
- });
-
- test('should handle 500 internal server error', async () => {
- const mockToken = 'valid-token';
- const mockError = {
- response: {
- status: 500,
- data: { message: 'Internal Server Error' }
- }
- };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toEqual(mockError);
- });
-
- test('should handle 403 forbidden error', async () => {
- const mockToken = 'valid-token';
- const mockError = {
- response: {
- status: 403,
- data: { message: 'Forbidden' }
- }
- };
- mockApiClient.get.mockRejectedValue(mockError);
-
- await expect(getGroups(mockToken)).rejects.toEqual(mockError);
- });
-
- test('should handle malformed response', async () => {
- const mockToken = 'valid-token';
- const mockResponse = 'not json';
- mockApiClient.get.mockResolvedValue(mockResponse);
-
- const result = await getGroups(mockToken);
-
- expect(result).toBe(mockResponse);
- });
- });
-
- describe('Edge Cases', () => {
- test('should handle very long tokens', async () => {
- const mockToken = 'a'.repeat(10000);
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- });
- });
-
- test('should handle tokens with special characters', async () => {
- const mockToken = 'token@#$%^&*()_+-={}[]|\\:";\'<>?,./';
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- });
- });
-
- test('should handle tokens with unicode characters', async () => {
- const mockToken = 'token🎉🎊';
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroups(mockToken);
-
- expect(mockApiClient.get).toHaveBeenCalledWith('/groups', {
- headers: {
- Authorization: `Bearer ${mockToken}`,
- },
- });
- });
-
- test('should handle boolean values as group IDs', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = true;
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroupMembers(mockToken, mockGroupId);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- '/groups/true/members',
- expect.any(Object)
- );
- });
-
- test('should handle object as group ID', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = { id: 123 };
- mockApiClient.get.mockResolvedValue({ data: [] });
-
- await getGroupMembers(mockToken, mockGroupId);
-
- expect(mockApiClient.get).toHaveBeenCalledWith(
- '/groups/[object Object]/members',
- expect.any(Object)
- );
- });
- });
-
- describe('Concurrent Requests', () => {
- test('should handle multiple concurrent getGroups calls', async () => {
- const mockToken = 'valid-token';
- const mockResponse1 = { data: [{ id: 1, name: 'Group 1' }] };
- const mockResponse2 = { data: [{ id: 2, name: 'Group 2' }] };
-
- mockApiClient.get
- .mockResolvedValueOnce(mockResponse1)
- .mockResolvedValueOnce(mockResponse2);
-
- const [result1, result2] = await Promise.all([
- getGroups(mockToken),
- getGroups(mockToken)
- ]);
-
- expect(result1).toBe(mockResponse1);
- expect(result2).toBe(mockResponse2);
- expect(mockApiClient.get).toHaveBeenCalledTimes(2);
- });
-
- test('should handle mixed successful and failed concurrent requests', async () => {
- const mockToken = 'valid-token';
- const mockResponse = { data: [] };
- const mockError = new Error('Failed request');
-
- mockApiClient.get
- .mockResolvedValueOnce(mockResponse)
- .mockRejectedValueOnce(mockError);
-
- const results = await Promise.allSettled([
- getGroups(mockToken),
- getGroups(mockToken)
- ]);
-
- expect(results[0].status).toBe('fulfilled');
- expect(results[0].value).toBe(mockResponse);
- expect(results[1].status).toBe('rejected');
- expect(results[1].reason).toBe(mockError);
- });
- });
-
- describe('Integration Tests', () => {
- test('should handle complete group workflow', async () => {
- const mockToken = 'valid-token';
- const mockGroupName = 'Test Group';
- const mockGroupId = 'group-123';
- const mockExpenseData = { description: 'Test expense', amount: 100 };
-
- // Mock responses for the complete workflow
- const createGroupResponse = { data: { id: mockGroupId, name: mockGroupName } };
- const getMembersResponse = { data: [{ id: 'user-1', name: 'User 1' }] };
- const getExpensesResponse = { data: [] };
- const createExpenseResponse = { data: { id: 'expense-1', ...mockExpenseData } };
-
- mockApiClient.post
- .mockResolvedValueOnce(createGroupResponse) // createGroup
- .mockResolvedValueOnce(createExpenseResponse); // createExpense
-
- mockApiClient.get
- .mockResolvedValueOnce(getMembersResponse) // getGroupMembers
- .mockResolvedValueOnce(getExpensesResponse); // getGroupExpenses
-
- // Execute workflow
- const groupResult = await createGroup(mockToken, mockGroupName);
- expect(groupResult).toBe(createGroupResponse);
-
- const detailsResult = await getGroupDetails(mockToken, mockGroupId);
- expect(detailsResult).toEqual([getMembersResponse, getExpensesResponse]);
-
- const expenseResult = await createExpense(mockToken, mockGroupId, mockExpenseData);
- expect(expenseResult).toBe(createExpenseResponse);
- });
-
- test('should handle authentication flow with all endpoints', async () => {
- const mockToken = 'auth-token-123';
-
- // Mock responses for all authenticated endpoints
- mockApiClient.get
- .mockResolvedValueOnce({ data: [] }) // getGroups
- .mockResolvedValueOnce({ data: { totalOwed: 0, totalOwing: 0, netBalance: 0 } }) // getUserBalanceSummary
- .mockResolvedValueOnce({ data: [] }); // getFriendsBalance
-
- // Test all authenticated endpoints
- await getGroups(mockToken);
- await getUserBalanceSummary(mockToken);
- await getFriendsBalance(mockToken);
-
- // Verify all calls used the same token
- expect(mockApiClient.get).toHaveBeenCalledTimes(3);
- mockApiClient.get.mock.calls.forEach(call => {
- expect(call[1].headers.Authorization).toBe(`Bearer ${mockToken}`);
- });
- });
- });
-
- describe('Performance Tests', () => {
- test('should handle rapid sequential API calls', async () => {
- const mockToken = 'valid-token';
- const numCalls = 10;
-
- // Mock responses for all calls
- for (let i = 0; i < numCalls; i++) {
- mockApiClient.get.mockResolvedValueOnce({ data: [`group-${i}`] });
- }
-
- // Make rapid sequential calls
- const promises = [];
- for (let i = 0; i < numCalls; i++) {
- promises.push(getGroups(mockToken));
- }
-
- const results = await Promise.all(promises);
-
- expect(results).toHaveLength(numCalls);
- expect(mockApiClient.get).toHaveBeenCalledTimes(numCalls);
- });
-
- test('should maintain correct call order with mixed async operations', async () => {
- const mockToken = 'valid-token';
- const mockGroupId = 'group-123';
-
- // Mock different response times by using different delays
- mockApiClient.get
- .mockImplementationOnce(() => new Promise(resolve =>
- setTimeout(() => resolve({ data: 'first' }), 100)))
- .mockImplementationOnce(() => new Promise(resolve =>
- setTimeout(() => resolve({ data: 'second' }), 50)))
- .mockImplementationOnce(() => new Promise(resolve =>
- setTimeout(() => resolve({ data: 'third' }), 25)));
-
- const [first, second, third] = await Promise.all([
- getGroups(mockToken),
- getGroupMembers(mockToken, mockGroupId),
- getGroupExpenses(mockToken, mockGroupId)
- ]);
-
- // Results should match the order of calls, not completion order
- expect(first.data).toBe('first');
- expect(second.data).toBe('second');
- expect(third.data).toBe('third');
- });
- });
-});
\ No newline at end of file
diff --git a/frontend/babel.config.js b/frontend/babel.config.js
deleted file mode 100644
index ec9bc813..00000000
--- a/frontend/babel.config.js
+++ /dev/null
@@ -1,13 +0,0 @@
-module.exports = function(api) {
- api.cache(true);
- return {
- presets: ['babel-preset-expo'],
- plugins: [
- ['module-resolver', {
- alias: {
- '@': './src',
- },
- }],
- ],
- };
-};
\ No newline at end of file
diff --git a/frontend/jest.setup.js b/frontend/jest.setup.js
deleted file mode 100644
index 73951f78..00000000
--- a/frontend/jest.setup.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jest setup file for additional configuration
-import 'react-native-gesture-handler/jestSetup';
-
-// Mock react-native modules that might cause issues in testing
-jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
-
-// Mock AsyncStorage
-jest.mock('@react-native-async-storage/async-storage', () =>
- require('@react-native-async-storage/async-storage/jest/async-storage-mock')
-);
-
-// Mock react-navigation
-jest.mock('@react-navigation/native', () => {
- return {
- useNavigation: () => ({
- navigate: jest.fn(),
- goBack: jest.fn(),
- }),
- useRoute: () => ({
- params: {},
- }),
- };
-});
-
-// Global test timeout
-jest.setTimeout(10000);
\ No newline at end of file
diff --git a/frontend/package.json b/frontend/package.json
index 95bc3656..3e33c375 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -6,10 +6,7 @@
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
- "web": "expo start --web",
- "test": "jest",
- "test:watch": "jest --watch",
- "test:coverage": "jest --coverage"
+ "web": "expo start --web"
},
"dependencies": {
"@expo/metro-runtime": "~5.0.4",
@@ -29,34 +26,7 @@
"react-native-web": "^0.20.0"
},
"devDependencies": {
- "@babel/core": "^7.20.0",
- "jest": "^29.7.0",
- "@jest/environment-jsdom": "^29.7.0",
- "babel-jest": "^29.7.0"
+ "@babel/core": "^7.20.0"
},
- "private": true,
- "jest": {
- "preset": "react-native",
- "testEnvironment": "jsdom",
- "setupFilesAfterEnv": [
- "/jest.setup.js"
- ],
- "moduleFileExtensions": [
- "js",
- "jsx",
- "json"
- ],
- "transform": {
- "^.+\\.(js|jsx)$": "babel-jest"
- },
- "testMatch": [
- "**/__tests__/**/*.(js|jsx)",
- "**/*.(test|spec).(js|jsx)"
- ],
- "collectCoverageFrom": [
- "api/**/*.{js,jsx}",
- "!api/**/*.test.{js,jsx}",
- "!**/node_modules/**"
- ]
- }
+ "private": true
}
diff --git a/frontend/screens/FriendsScreen.test.js b/frontend/screens/FriendsScreen.test.js
deleted file mode 100644
index 63d87a9a..00000000
--- a/frontend/screens/FriendsScreen.test.js
+++ /dev/null
@@ -1,597 +0,0 @@
-import React from 'react';
-import { render, waitFor, fireEvent, act } from '@testing-library/react-native';
-import { Alert } from 'react-native';
-import { useIsFocused } from '@react-navigation/native';
-import FriendsScreen from './FriendsScreen';
-import { getFriendsBalance } from '../api/groups';
-import { AuthContext } from '../context/AuthContext';
-
-// Mock dependencies
-jest.mock('@react-navigation/native', () => ({
- useIsFocused: jest.fn(),
-}));
-
-jest.mock('../api/groups', () => ({
- getFriendsBalance: jest.fn(),
-}));
-
-jest.mock('react-native', () => {
- const RN = jest.requireActual('react-native');
- return {
- ...RN,
- Alert: {
- alert: jest.fn(),
- },
- };
-});
-
-// Mock console.error to avoid noise in tests
-const originalConsoleError = console.error;
-beforeAll(() => {
- console.error = jest.fn();
-});
-
-afterAll(() => {
- console.error = originalConsoleError;
-});
-
-describe('FriendsScreen', () => {
- const mockAuthContext = {
- token: 'mock-token',
- user: { id: '1', name: 'Test User' },
- };
-
- const mockFriendsResponse = {
- data: {
- friendsBalance: [
- {
- userId: '1',
- userName: 'John Doe',
- netBalance: 25.50,
- breakdown: [
- {
- groupId: 'group1',
- groupName: 'Group 1',
- balance: 15.25,
- },
- {
- groupId: 'group2',
- groupName: 'Group 2',
- balance: 10.25,
- },
- ],
- },
- {
- userId: '2',
- userName: 'Jane Smith',
- netBalance: -12.75,
- breakdown: [
- {
- groupId: 'group1',
- groupName: 'Group 1',
- balance: -12.75,
- },
- ],
- },
- ],
- },
- };
-
- const renderWithContext = (contextValue = mockAuthContext) => {
- return render(
-
-
-
- );
- };
-
- beforeEach(() => {
- jest.clearAllMocks();
- useIsFocused.mockReturnValue(true);
- getFriendsBalance.mockResolvedValue(mockFriendsResponse);
- });
-
- describe('Component Rendering', () => {
- test('should render the Friends header', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Friends')).toBeTruthy();
- });
- });
-
- test('should show loading indicator initially', () => {
- const { queryByText } = renderWithContext();
-
- // Component should be in loading state initially, so empty message shouldn't be visible yet
- expect(queryByText('No balances with friends yet.')).toBeNull();
- });
-
- test('should render tooltip by default', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText(/These amounts show your direct balance with each friend/)).toBeTruthy();
- });
- });
-
- test('should hide tooltip when close button is pressed', async () => {
- const { getByText, queryByText, UNSAFE_getByType } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText(/These amounts show your direct balance with each friend/)).toBeTruthy();
- });
-
- // Find the IconButton by type since it may not have accessible role
- const iconButtons = UNSAFE_getByType('IconButton');
- fireEvent.press(iconButtons);
-
- expect(queryByText(/These amounts show your direct balance with each friend/)).toBeNull();
- });
- });
-
- describe('Data Fetching', () => {
- test('should fetch friends data when component is focused and token exists', async () => {
- renderWithContext();
-
- await waitFor(() => {
- expect(getFriendsBalance).toHaveBeenCalledWith('mock-token');
- });
- });
-
- test('should not fetch data when token is missing', async () => {
- const contextWithoutToken = { ...mockAuthContext, token: null };
- renderWithContext(contextWithoutToken);
-
- await waitFor(() => {
- expect(getFriendsBalance).not.toHaveBeenCalled();
- }, { timeout: 1000 });
- });
-
- test('should not fetch data when screen is not focused', async () => {
- useIsFocused.mockReturnValue(false);
- renderWithContext();
-
- await waitFor(() => {
- expect(getFriendsBalance).not.toHaveBeenCalled();
- }, { timeout: 1000 });
- });
-
- test('should refetch data when token changes', async () => {
- const { rerender } = renderWithContext();
-
- await waitFor(() => {
- expect(getFriendsBalance).toHaveBeenCalledWith('mock-token');
- });
-
- const newContext = { ...mockAuthContext, token: 'new-token' };
- rerender(
-
-
-
- );
-
- await waitFor(() => {
- expect(getFriendsBalance).toHaveBeenCalledWith('new-token');
- });
- });
- });
-
- describe('Friends List Rendering', () => {
- test('should render friends list after successful data fetch', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('John Doe')).toBeTruthy();
- expect(getByText('Jane Smith')).toBeTruthy();
- });
- });
-
- test('should display correct balance text for positive balance', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Owes you $25.50')).toBeTruthy();
- });
- });
-
- test('should display correct balance text for negative balance', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You owe $12.75')).toBeTruthy();
- });
- });
-
- test('should display settled up for zero balance', async () => {
- const mockResponseWithZeroBalance = {
- data: {
- friendsBalance: [
- {
- userId: '3',
- userName: 'Zero Balance Friend',
- netBalance: 0,
- breakdown: [],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(mockResponseWithZeroBalance);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Settled up')).toBeTruthy();
- });
- });
-
- test('should render group breakdown within friend accordion', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('John Doe')).toBeTruthy();
- // Groups should be rendered as part of the accordion structure
- expect(getByText('Group 1')).toBeTruthy();
- expect(getByText('Group 2')).toBeTruthy();
- });
- });
-
- test('should display empty state when no friends data', async () => {
- getFriendsBalance.mockResolvedValue({ data: { friendsBalance: [] } });
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('No balances with friends yet.')).toBeTruthy();
- });
- });
-
- test('should handle missing friendsBalance property', async () => {
- getFriendsBalance.mockResolvedValue({ data: {} });
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('No balances with friends yet.')).toBeTruthy();
- });
- });
- });
-
- describe('Error Handling', () => {
- test('should show error alert when API call fails', async () => {
- const mockError = new Error('Network error');
- getFriendsBalance.mockRejectedValue(mockError);
-
- renderWithContext();
-
- await waitFor(() => {
- expect(console.error).toHaveBeenCalledWith('Failed to fetch friends balance data:', mockError);
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to load friends balance data.');
- });
- });
-
- test('should stop loading state after error', async () => {
- getFriendsBalance.mockRejectedValue(new Error('Network error'));
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('No balances with friends yet.')).toBeTruthy();
- });
- });
- });
-
- describe('Data Transformation', () => {
- test('should correctly transform backend data to frontend format', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Verify that the transformed data is correctly displayed
- expect(getByText('John Doe')).toBeTruthy(); // userName -> name
- expect(getByText('Owes you $25.50')).toBeTruthy(); // netBalance formatted
- });
- });
-
- test('should handle friends with complex group structures', async () => {
- const complexMockResponse = {
- data: {
- friendsBalance: [
- {
- userId: '4',
- userName: 'Complex Friend',
- netBalance: 100.00,
- breakdown: [
- {
- groupId: 'g1',
- groupName: 'Group Alpha',
- balance: 50.00,
- },
- {
- groupId: 'g2',
- groupName: 'Group Beta',
- balance: 30.00,
- },
- {
- groupId: 'g3',
- groupName: 'Group Gamma',
- balance: 20.00,
- },
- ],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(complexMockResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Complex Friend')).toBeTruthy();
- expect(getByText('Owes you $100.00')).toBeTruthy();
- });
- });
- });
-
- describe('Edge Cases', () => {
- test('should handle very small positive balances', async () => {
- const smallBalanceResponse = {
- data: {
- friendsBalance: [
- {
- userId: '5',
- userName: 'Small Balance',
- netBalance: 0.01,
- breakdown: [{
- groupId: 'g1',
- groupName: 'Test Group',
- balance: 0.01,
- }],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(smallBalanceResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Owes you $0.01')).toBeTruthy();
- });
- });
-
- test('should handle very small negative balances', async () => {
- const smallNegativeBalanceResponse = {
- data: {
- friendsBalance: [
- {
- userId: '6',
- userName: 'Small Negative Balance',
- netBalance: -0.01,
- breakdown: [{
- groupId: 'g1',
- groupName: 'Test Group',
- balance: -0.01,
- }],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(smallNegativeBalanceResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You owe $0.01')).toBeTruthy();
- });
- });
-
- test('should handle friends with no groups', async () => {
- const noGroupsResponse = {
- data: {
- friendsBalance: [
- {
- userId: '7',
- userName: 'No Groups Friend',
- netBalance: 25.00,
- breakdown: [],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(noGroupsResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('No Groups Friend')).toBeTruthy();
- expect(getByText('Owes you $25.00')).toBeTruthy();
- });
- });
-
- test('should handle malformed API response gracefully', async () => {
- getFriendsBalance.mockResolvedValue(null);
-
- renderWithContext();
-
- await waitFor(() => {
- expect(console.error).toHaveBeenCalled();
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to load friends balance data.');
- });
- });
- });
-
- describe('Balance Formatting', () => {
- test('should format large balances correctly', async () => {
- const largeBalanceResponse = {
- data: {
- friendsBalance: [
- {
- userId: '8',
- userName: 'Rich Friend',
- netBalance: 1234.56,
- breakdown: [{
- groupId: 'g1',
- groupName: 'Expensive Group',
- balance: 1234.56,
- }],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(largeBalanceResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Owes you $1234.56')).toBeTruthy();
- });
- });
-
- test('should handle balances with more than 2 decimal places', async () => {
- const preciseBalanceResponse = {
- data: {
- friendsBalance: [
- {
- userId: '9',
- userName: 'Precise Friend',
- netBalance: 123.456789,
- breakdown: [{
- groupId: 'g1',
- groupName: 'Precise Group',
- balance: 123.456789,
- }],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(preciseBalanceResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Owes you $123.46')).toBeTruthy();
- });
- });
- });
-
- describe('Component Lifecycle', () => {
- test('should maintain tooltip state when component re-renders', async () => {
- const { getByText, queryByText, UNSAFE_getByType, rerender } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText(/These amounts show your direct balance/)).toBeTruthy();
- });
-
- const iconButton = UNSAFE_getByType('IconButton');
- fireEvent.press(iconButton);
-
- expect(queryByText(/These amounts show your direct balance/)).toBeNull();
-
- // Re-render with same context
- rerender(
-
-
-
- );
-
- // Tooltip should remain hidden after re-render
- expect(queryByText(/These amounts show your direct balance/)).toBeNull();
- });
-
- test('should handle undefined or null context gracefully', async () => {
- const nullContext = { token: null, user: null };
- const { queryByText } = renderWithContext(nullContext);
-
- // Should not crash and should not fetch data
- expect(getFriendsBalance).not.toHaveBeenCalled();
-
- await waitFor(() => {
- expect(queryByText('No balances with friends yet.')).toBeTruthy();
- });
- });
- });
-
- describe('Group Balance Display', () => {
- test('should display correct color coding for positive group balances', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Verify group balance text is displayed
- expect(getByText('Owes you $15.25')).toBeTruthy();
- expect(getByText('Owes you $10.25')).toBeTruthy();
- });
- });
-
- test('should display correct color coding for negative group balances', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Verify negative group balance text is displayed
- expect(getByText('You owe $12.75')).toBeTruthy();
- });
- });
-
- test('should handle zero group balances', async () => {
- const zeroGroupBalanceResponse = {
- data: {
- friendsBalance: [
- {
- userId: '10',
- userName: 'Zero Group Balance Friend',
- netBalance: 0,
- breakdown: [{
- groupId: 'g1',
- groupName: 'Zero Group',
- balance: 0,
- }],
- },
- ],
- },
- };
-
- getFriendsBalance.mockResolvedValue(zeroGroupBalanceResponse);
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Zero Group Balance Friend')).toBeTruthy();
- expect(getByText('Settled up')).toBeTruthy();
- });
- });
- });
-
- describe('Accessibility and UX', () => {
- test('should have proper key extractors for FlatList', async () => {
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('John Doe')).toBeTruthy();
- expect(getByText('Jane Smith')).toBeTruthy();
- });
-
- // The component should render without React key warnings
- // This is implicitly tested by the successful rendering
- });
-
- test('should handle rapid state changes gracefully', async () => {
- let resolvePromise;
- const slowPromise = new Promise((resolve) => {
- resolvePromise = resolve;
- });
-
- getFriendsBalance.mockReturnValue(slowPromise);
- const { rerender } = renderWithContext();
-
- // Change context while API call is pending
- const newContext = { ...mockAuthContext, token: 'new-token' };
- rerender(
-
-
-
- );
-
- // Resolve the promise
- resolvePromise(mockFriendsResponse);
-
- await waitFor(() => {
- expect(getFriendsBalance).toHaveBeenCalledTimes(2);
- });
- });
- });
-});
\ No newline at end of file
diff --git a/frontend/screens/GroupDetailsScreen.test.js b/frontend/screens/GroupDetailsScreen.test.js
deleted file mode 100644
index 50e4521d..00000000
--- a/frontend/screens/GroupDetailsScreen.test.js
+++ /dev/null
@@ -1,1078 +0,0 @@
-import React from 'react';
-import { render, fireEvent, waitFor, act } from '@testing-library/react-native';
-import { Alert } from 'react-native';
-import GroupDetailsScreen from './GroupDetailsScreen';
-import { AuthContext } from '../context/AuthContext';
-import { getGroupExpenses, getGroupMembers, getOptimizedSettlements } from '../api/groups';
-
-// Mock the API functions
-jest.mock('../api/groups', () => ({
- getGroupExpenses: jest.fn(),
- getGroupMembers: jest.fn(),
- getOptimizedSettlements: jest.fn(),
-}));
-
-// Mock React Native components and modules
-jest.mock('react-native', () => {
- const RN = jest.requireActual('react-native');
- return {
- ...RN,
- Alert: {
- alert: jest.fn(),
- },
- };
-});
-
-// Mock react-native-paper components
-jest.mock('react-native-paper', () => ({
- ActivityIndicator: ({ testID }) => {
- const React = require('react');
- const { View } = require('react-native');
- return React.createElement(View, { testID: testID || 'activity-indicator' });
- },
- Card: Object.assign(
- ({ children, style }) => {
- const React = require('react');
- const { View } = require('react-native');
- return React.createElement(View, { style, testID: 'card' }, children);
- },
- {
- Content: ({ children }) => {
- const React = require('react');
- const { View } = require('react-native');
- return React.createElement(View, { testID: 'card-content' }, children);
- },
- }
- ),
- FAB: ({ onPress, testID, icon }) => {
- const React = require('react');
- const { TouchableOpacity, Text } = require('react-native');
- return React.createElement(
- TouchableOpacity,
- { onPress, testID: testID || 'fab' },
- React.createElement(Text, null, icon)
- );
- },
- Paragraph: ({ children, style }) => {
- const React = require('react');
- const { Text } = require('react-native');
- return React.createElement(Text, { style }, children);
- },
- Title: ({ children, style }) => {
- const React = require('react');
- const { Text } = require('react-native');
- return React.createElement(Text, { style }, children);
- },
-}));
-
-// Mock navigation
-const mockNavigation = {
- setOptions: jest.fn(),
- navigate: jest.fn(),
-};
-
-// Mock route
-const mockRoute = {
- params: {
- groupId: 'group123',
- groupName: 'Test Group',
- groupIcon: 'group-icon',
- },
-};
-
-// Mock AuthContext values
-const mockAuthContext = {
- token: 'test-token',
- user: {
- _id: 'user123',
- name: 'Test User',
- },
-};
-
-// Helper function to render component with context
-const renderWithContext = (authContext = mockAuthContext) => {
- return render(
-
-
-
- );
-};
-
-describe('GroupDetailsScreen', () => {
- beforeEach(() => {
- jest.clearAllMocks();
- Alert.alert.mockClear();
- });
-
- describe('Initial Loading and Setup', () => {
- it('should set navigation title on mount', () => {
- renderWithContext();
- expect(mockNavigation.setOptions).toHaveBeenCalledWith({
- title: 'Test Group',
- });
- });
-
- it('should show loading indicator initially', () => {
- // Mock all API calls to never resolve to keep loading state
- getGroupMembers.mockImplementation(() => new Promise(() => {}));
- getGroupExpenses.mockImplementation(() => new Promise(() => {}));
- getOptimizedSettlements.mockImplementation(() => new Promise(() => {}));
-
- const { getByTestId } = renderWithContext();
- expect(getByTestId('activity-indicator')).toBeTruthy();
- });
-
- it('should not fetch data when token is missing', () => {
- renderWithContext({ ...mockAuthContext, token: null });
- expect(getGroupExpenses).not.toHaveBeenCalled();
- expect(getGroupMembers).not.toHaveBeenCalled();
- expect(getOptimizedSettlements).not.toHaveBeenCalled();
- });
-
- it('should not fetch data when groupId is missing', () => {
- const routeWithoutGroupId = {
- params: {
- groupId: null,
- groupName: 'Test Group',
- groupIcon: 'group-icon',
- },
- };
- render(
-
-
-
- );
- expect(getGroupExpenses).not.toHaveBeenCalled();
- });
- });
-
- describe('Data Fetching', () => {
- const mockMembers = [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } },
- ];
-
- const mockExpenses = [
- {
- _id: 'expense1',
- description: 'Lunch',
- amount: 100,
- paidBy: 'user123',
- createdBy: 'user123',
- splits: [
- { userId: 'user123', amount: 50 },
- { userId: 'user456', amount: 50 },
- ],
- },
- ];
-
- const mockSettlements = [
- {
- fromUserId: 'user456',
- toUserId: 'user123',
- amount: 25,
- },
- ];
-
- it('should fetch all data successfully', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'group123');
- expect(getGroupExpenses).toHaveBeenCalledWith('test-token', 'group123');
- expect(getOptimizedSettlements).toHaveBeenCalledWith('test-token', 'group123');
- });
-
- await waitFor(() => {
- expect(getByText('Settlement Summary')).toBeTruthy();
- expect(getByText('Members')).toBeTruthy();
- expect(getByText('Expenses')).toBeTruthy();
- });
- });
-
- it('should handle API errors gracefully', async () => {
- const error = new Error('Network error');
- getGroupMembers.mockRejectedValue(error);
- getGroupExpenses.mockRejectedValue(error);
- getOptimizedSettlements.mockRejectedValue(error);
-
- const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
-
- renderWithContext();
-
- await waitFor(() => {
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch group details.');
- });
-
- consoleSpy.mockRestore();
- });
-
- it('should handle missing settlements data', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
- getOptimizedSettlements.mockResolvedValue({ data: {} });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('✓ You are all settled up!')).toBeTruthy();
- });
- });
-
- it('should fetch data when both token and groupId are present', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- renderWithContext();
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'group123');
- expect(getGroupExpenses).toHaveBeenCalledWith('test-token', 'group123');
- expect(getOptimizedSettlements).toHaveBeenCalledWith('test-token', 'group123');
- });
- });
- });
-
- describe('Currency Formatting', () => {
- it('should format currency with INR symbol and two decimal places', async () => {
- const mockMembers = [{ userId: 'user123', user: { name: 'Test User' } }];
- const mockExpenses = [{
- _id: 'expense1',
- description: 'Test Expense',
- amount: 123.45,
- paidBy: 'user123',
- splits: [{ userId: 'user123', amount: 123.45 }],
- }];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Amount: ₹123.45')).toBeTruthy();
- });
- });
-
- it('should format whole numbers with .00', async () => {
- const mockMembers = [{ userId: 'user123', user: { name: 'Test User' } }];
- const mockExpenses = [{
- _id: 'expense1',
- description: 'Test Expense',
- amount: 100,
- paidBy: 'user123',
- splits: [{ userId: 'user123', amount: 100 }],
- }];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockExpenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Amount: ₹100.00')).toBeTruthy();
- });
- });
- });
-
- describe('Member Name Resolution', () => {
- const mockMembers = [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } },
- ];
-
- it('should resolve member names correctly', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('• Test User')).toBeTruthy();
- expect(getByText('• Jane Doe')).toBeTruthy();
- });
- });
-
- it('should handle unknown users gracefully', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({
- data: {
- expenses: [{
- _id: 'expense1',
- description: 'Test Expense',
- amount: 100,
- paidBy: 'unknown-user',
- splits: [{ userId: 'user123', amount: 100 }],
- }],
- },
- });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Paid by: Unknown')).toBeTruthy();
- });
- });
-
- it('should return "Unknown" for non-existent user IDs in settlements', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({
- data: {
- optimizedSettlements: [{
- fromUserId: 'user123',
- toUserId: 'nonexistent-user',
- amount: 50,
- }],
- },
- });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Unknown')).toBeTruthy();
- });
- });
- });
-
- describe('Expense Rendering', () => {
- const mockMembers = [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } },
- ];
-
- it('should render expense when user is owed money', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Lunch',
- amount: 100,
- paidBy: 'user123',
- splits: [
- { userId: 'user123', amount: 40 },
- { userId: 'user456', amount: 60 },
- ],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Lunch')).toBeTruthy();
- expect(getByText('Amount: ₹100.00')).toBeTruthy();
- expect(getByText('Paid by: Test User')).toBeTruthy();
- expect(getByText('You are owed ₹60.00')).toBeTruthy();
- });
- });
-
- it('should render expense when user owes money', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Dinner',
- amount: 100,
- paidBy: 'user456',
- splits: [
- { userId: 'user123', amount: 60 },
- { userId: 'user456', amount: 40 },
- ],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Dinner')).toBeTruthy();
- expect(getByText('You borrowed ₹60.00')).toBeTruthy();
- });
- });
-
- it('should render expense when user is settled', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Coffee',
- amount: 100,
- paidBy: 'user123',
- splits: [
- { userId: 'user123', amount: 100 },
- ],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Coffee')).toBeTruthy();
- expect(getByText('You are settled for this expense.')).toBeTruthy();
- });
- });
-
- it('should handle expenses with missing splits', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Test Expense',
- amount: 100,
- paidBy: 'user456',
- splits: [],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Test Expense')).toBeTruthy();
- expect(getByText('You borrowed ₹0.00')).toBeTruthy();
- });
- });
-
- it('should use createdBy when paidBy is missing', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Test Expense',
- amount: 100,
- createdBy: 'user456',
- splits: [{ userId: 'user123', amount: 50 }],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Paid by: Jane Doe')).toBeTruthy();
- });
- });
-
- it('should handle expenses with null splits array', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Test Expense',
- amount: 100,
- paidBy: 'user456',
- splits: null,
- };
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Test Expense')).toBeTruthy();
- // Should not crash and should show some default behavior
- });
- });
- });
-
- describe('Settlement Summary', () => {
- const mockMembers = [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } },
- { userId: 'user789', user: { name: 'Bob Smith' } },
- ];
-
- it('should show settled message when no settlements exist', async () => {
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('✓ You are all settled up!')).toBeTruthy();
- });
- });
-
- it('should show amounts user owes', async () => {
- const settlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
- { fromUserId: 'user123', toUserId: 'user789', amount: 30 },
- ];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You need to pay: ₹80.00')).toBeTruthy();
- expect(getByText('Jane Doe')).toBeTruthy();
- expect(getByText('Bob Smith')).toBeTruthy();
- expect(getByText('₹50.00')).toBeTruthy();
- expect(getByText('₹30.00')).toBeTruthy();
- });
- });
-
- it('should show amounts user will receive', async () => {
- const settlements = [
- { fromUserId: 'user456', toUserId: 'user123', amount: 40 },
- { fromUserId: 'user789', toUserId: 'user123', amount: 20 },
- ];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You will receive: ₹60.00')).toBeTruthy();
- expect(getByText('Jane Doe')).toBeTruthy();
- expect(getByText('Bob Smith')).toBeTruthy();
- });
- });
-
- it('should show both owing and receiving sections', async () => {
- const settlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 25 },
- { fromUserId: 'user789', toUserId: 'user123', amount: 35 },
- ];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You need to pay: ₹25.00')).toBeTruthy();
- expect(getByText('You will receive: ₹35.00')).toBeTruthy();
- });
- });
-
- it('should handle settlements with unknown users', async () => {
- const settlements = [
- { fromUserId: 'user123', toUserId: 'unknown-user', amount: 25 },
- ];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Unknown')).toBeTruthy();
- });
- });
-
- it('should calculate totals correctly for complex settlements', async () => {
- const settlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 25.50 },
- { fromUserId: 'user123', toUserId: 'user789', amount: 30.75 },
- { fromUserId: 'user456', toUserId: 'user123', amount: 15.25 },
- ];
-
- getGroupMembers.mockResolvedValue({ data: mockMembers });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: settlements } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('You need to pay: ₹56.25')).toBeTruthy(); // 25.50 + 30.75
- expect(getByText('You will receive: ₹15.25')).toBeTruthy();
- });
- });
- });
-
- describe('Empty States', () => {
- it('should show empty expenses message', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('No expenses recorded yet.')).toBeTruthy();
- });
- });
-
- it('should show members section even when empty', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Members')).toBeTruthy();
- });
- });
-
- it('should handle empty API responses gracefully', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Settlement Summary')).toBeTruthy();
- expect(getByText('Members')).toBeTruthy();
- expect(getByText('Expenses')).toBeTruthy();
- expect(getByText('✓ You are all settled up!')).toBeTruthy();
- });
- });
- });
-
- describe('FAB Navigation', () => {
- it('should navigate to AddExpense screen when FAB is pressed', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByTestId } = renderWithContext();
-
- await waitFor(() => {
- const fab = getByTestId('fab');
- fireEvent.press(fab);
- expect(mockNavigation.navigate).toHaveBeenCalledWith('AddExpense', {
- groupId: 'group123',
- });
- });
- });
-
- it('should pass correct groupId to AddExpense screen', async () => {
- const customRoute = {
- params: {
- groupId: 'custom-group-456',
- groupName: 'Custom Group',
- groupIcon: 'custom-icon',
- },
- };
-
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByTestId } = render(
-
-
-
- );
-
- await waitFor(() => {
- const fab = getByTestId('fab');
- fireEvent.press(fab);
- expect(mockNavigation.navigate).toHaveBeenCalledWith('AddExpense', {
- groupId: 'custom-group-456',
- });
- });
- });
- });
-
- describe('Edge Cases and Error Handling', () => {
- it('should handle null/undefined values in expenses', async () => {
- const expenseWithNulls = {
- _id: 'expense1',
- description: null,
- amount: null,
- paidBy: null,
- createdBy: null,
- splits: null,
- };
-
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expenseWithNulls] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- // Should not crash when rendering
- expect(() => renderWithContext()).not.toThrow();
- });
-
- it('should handle malformed API responses', async () => {
- getGroupMembers.mockResolvedValue({ data: null });
- getGroupExpenses.mockResolvedValue({ data: null });
- getOptimizedSettlements.mockResolvedValue({ data: null });
-
- // Should not crash when handling null responses
- expect(() => renderWithContext()).not.toThrow();
- });
-
- it('should handle very large numbers in currency formatting', async () => {
- const expenseWithLargeAmount = {
- _id: 'expense1',
- description: 'Expensive Item',
- amount: 999999999.99,
- paidBy: 'user123',
- splits: [{ userId: 'user123', amount: 999999999.99 }],
- };
-
- getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expenseWithLargeAmount] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Amount: ₹999999999.99')).toBeTruthy();
- });
- });
-
- it('should handle zero amounts correctly', async () => {
- const zeroAmountExpense = {
- _id: 'expense1',
- description: 'Free Item',
- amount: 0,
- paidBy: 'user123',
- splits: [{ userId: 'user123', amount: 0 }],
- };
-
- getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [zeroAmountExpense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Amount: ₹0.00')).toBeTruthy();
- expect(getByText('You are settled for this expense.')).toBeTruthy();
- });
- });
-
- it('should handle negative amounts gracefully', async () => {
- const negativeAmountExpense = {
- _id: 'expense1',
- description: 'Refund',
- amount: -50,
- paidBy: 'user123',
- splits: [{ userId: 'user123', amount: -50 }],
- };
-
- getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [negativeAmountExpense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Amount: ₹-50.00')).toBeTruthy();
- });
- });
-
- it('should handle missing user in auth context', () => {
- const contextWithoutUser = {
- token: 'test-token',
- user: null,
- };
-
- expect(() => renderWithContext(contextWithoutUser)).not.toThrow();
- });
-
- it('should handle API responses with missing data fields', async () => {
- getGroupMembers.mockResolvedValue({});
- getGroupExpenses.mockResolvedValue({});
- getOptimizedSettlements.mockResolvedValue({});
-
- expect(() => renderWithContext()).not.toThrow();
- });
- });
-
- describe('Component State Management', () => {
- it('should update loading state correctly during data fetch', async () => {
- let resolvePromises;
- const promises = new Promise(resolve => { resolvePromises = resolve; });
-
- getGroupMembers.mockImplementation(() => promises);
- getGroupExpenses.mockImplementation(() => promises);
- getOptimizedSettlements.mockImplementation(() => promises);
-
- const { getByTestId, queryByTestId } = renderWithContext();
-
- // Should show loading initially
- expect(getByTestId('activity-indicator')).toBeTruthy();
-
- // Resolve promises
- act(() => {
- resolvePromises({ data: [] });
- });
-
- await waitFor(() => {
- expect(queryByTestId('activity-indicator')).toBeNull();
- });
- });
-
- it('should maintain state consistency after multiple re-renders', async () => {
- const mockData = {
- members: [{ userId: 'user123', user: { name: 'Test User' } }],
- expenses: [],
- settlements: [],
- };
-
- getGroupMembers.mockResolvedValue({ data: mockData.members });
- getGroupExpenses.mockResolvedValue({ data: { expenses: mockData.expenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockData.settlements } });
-
- const { rerender, getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('• Test User')).toBeTruthy();
- });
-
- // Re-render with same props
- rerender(
-
-
-
- );
-
- await waitFor(() => {
- expect(getByText('• Test User')).toBeTruthy();
- });
- });
-
- it('should handle concurrent API calls correctly', async () => {
- let resolveMembers, resolveExpenses, resolveSettlements;
-
- getGroupMembers.mockImplementation(() => new Promise(resolve => { resolveMembers = resolve; }));
- getGroupExpenses.mockImplementation(() => new Promise(resolve => { resolveExpenses = resolve; }));
- getOptimizedSettlements.mockImplementation(() => new Promise(resolve => { resolveSettlements = resolve; }));
-
- renderWithContext();
-
- // Resolve in different order
- act(() => {
- resolveExpenses({ data: { expenses: [] } });
- resolveSettlements({ data: { optimizedSettlements: [] } });
- resolveMembers({ data: [] });
- });
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalled();
- expect(getGroupExpenses).toHaveBeenCalled();
- expect(getOptimizedSettlements).toHaveBeenCalled();
- });
- });
- });
-
- describe('Accessibility and Performance', () => {
- it('should have proper key extractors for FlatList', async () => {
- const expenses = [
- { _id: 'expense1', description: 'Test 1', amount: 100, paidBy: 'user123', splits: [] },
- { _id: 'expense2', description: 'Test 2', amount: 200, paidBy: 'user123', splits: [] },
- ];
-
- getGroupMembers.mockResolvedValue({ data: [{ userId: 'user123', user: { name: 'Test User' } }] });
- getGroupExpenses.mockResolvedValue({ data: { expenses } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- expect(getByText('Test 1')).toBeTruthy();
- expect(getByText('Test 2')).toBeTruthy();
- });
- });
-
- it('should handle rapid state updates without race conditions', async () => {
- let callCount = 0;
- getGroupMembers.mockImplementation(() => {
- callCount++;
- return Promise.resolve({ data: [{ userId: `user${callCount}`, user: { name: `User ${callCount}` } }] });
- });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { rerender } = renderWithContext();
-
- // Trigger multiple re-renders quickly
- for (let i = 0; i < 3; i++) {
- rerender(
-
-
-
- );
- }
-
- await waitFor(() => {
- // Should eventually settle without crashing
- expect(getGroupMembers).toHaveBeenCalled();
- });
- });
-
- it('should render cards with proper structure', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getAllByTestId } = renderWithContext();
-
- await waitFor(() => {
- const cards = getAllByTestId('card');
- expect(cards.length).toBeGreaterThan(0);
- });
- });
- });
-
- describe('Calculation Logic', () => {
- it('should calculate net balance correctly for user who paid', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Shared Lunch',
- amount: 120,
- paidBy: 'user123', // Current user paid
- splits: [
- { userId: 'user123', amount: 60 }, // Current user's share
- { userId: 'user456', amount: 60 }, // Other user's share
- ],
- };
-
- getGroupMembers.mockResolvedValue({
- data: [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } }
- ]
- });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Net = 120 (paid) - 60 (share) = 60 (owed)
- expect(getByText('You are owed ₹60.00')).toBeTruthy();
- });
- });
-
- it('should calculate net balance correctly for user who did not pay', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Shared Dinner',
- amount: 150,
- paidBy: 'user456', // Other user paid
- splits: [
- { userId: 'user123', amount: 75 }, // Current user's share
- { userId: 'user456', amount: 75 }, // Other user's share
- ],
- };
-
- getGroupMembers.mockResolvedValue({
- data: [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } }
- ]
- });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Net = 0 (paid) - 75 (share) = -75 (borrowed)
- expect(getByText('You borrowed ₹75.00')).toBeTruthy();
- });
- });
-
- it('should handle unequal splits correctly', async () => {
- const expense = {
- _id: 'expense1',
- description: 'Unequal Split',
- amount: 100,
- paidBy: 'user123',
- splits: [
- { userId: 'user123', amount: 30 }, // Current user's smaller share
- { userId: 'user456', amount: 70 }, // Other user's larger share
- ],
- };
-
- getGroupMembers.mockResolvedValue({
- data: [
- { userId: 'user123', user: { name: 'Test User' } },
- { userId: 'user456', user: { name: 'Jane Doe' } }
- ]
- });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [expense] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithContext();
-
- await waitFor(() => {
- // Net = 100 (paid) - 30 (share) = 70 (owed)
- expect(getByText('You are owed ₹70.00')).toBeTruthy();
- });
- });
- });
-
- describe('useEffect Dependencies', () => {
- it('should refetch data when token changes', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { rerender } = renderWithContext();
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledTimes(1);
- });
-
- // Change token
- rerender(
-
-
-
- );
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledWith('new-token', 'group123');
- expect(getGroupMembers).toHaveBeenCalledTimes(2);
- });
- });
-
- it('should refetch data when groupId changes', async () => {
- getGroupMembers.mockResolvedValue({ data: [] });
- getGroupExpenses.mockResolvedValue({ data: { expenses: [] } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { rerender } = renderWithContext();
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledTimes(1);
- });
-
- // Change groupId
- const newRoute = {
- params: {
- groupId: 'new-group-456',
- groupName: 'New Group',
- groupIcon: 'new-icon',
- },
- };
-
- rerender(
-
-
-
- );
-
- await waitFor(() => {
- expect(getGroupMembers).toHaveBeenCalledWith('test-token', 'new-group-456');
- expect(getGroupMembers).toHaveBeenCalledTimes(2);
- });
- });
- });
-});
\ No newline at end of file
diff --git a/frontend/screens/HomeScreen.js b/frontend/screens/HomeScreen.js
index c361f74e..226aea44 100644
--- a/frontend/screens/HomeScreen.js
+++ b/frontend/screens/HomeScreen.js
@@ -185,10 +185,10 @@ const HomeScreen = ({ navigation }) => {
{isLoading ? (
-
+
) : (
- item._id}
diff --git a/frontend/screens/HomeScreen.test.js b/frontend/screens/HomeScreen.test.js
deleted file mode 100644
index d11be231..00000000
--- a/frontend/screens/HomeScreen.test.js
+++ /dev/null
@@ -1,851 +0,0 @@
-import React from 'react';
-import { render, fireEvent, waitFor, act } from '@testing-library/react-native';
-import { Alert } from 'react-native';
-import HomeScreen from './HomeScreen';
-import { AuthContext } from '../context/AuthContext';
-import { createGroup, getGroups, getOptimizedSettlements } from '../api/groups';
-
-// Mock the API functions
-jest.mock('../api/groups', () => ({
- createGroup: jest.fn(),
- getGroups: jest.fn(),
- getOptimizedSettlements: jest.fn(),
-}));
-
-// Mock Alert
-jest.spyOn(Alert, 'alert').mockImplementation(() => {});
-
-// Mock console.error to avoid noise in test output
-const mockConsoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
-
-// Mock navigation
-const mockNavigation = {
- navigate: jest.fn(),
-};
-
-// Mock AuthContext values
-const mockAuthContextValue = {
- token: 'mock-token-123',
- logout: jest.fn(),
- user: { _id: 'user123', name: 'Test User' },
-};
-
-const renderWithAuthContext = (authValue = mockAuthContextValue) => {
- return render(
-
-
-
- );
-};
-
-describe('HomeScreen', () => {
- beforeEach(() => {
- jest.clearAllMocks();
- Alert.alert.mockClear();
- mockNavigation.navigate.mockClear();
- mockConsoleError.mockClear();
- });
-
- afterAll(() => {
- mockConsoleError.mockRestore();
- });
-
- describe('Initial Loading and Data Fetching', () => {
- it('should display loading indicator initially', async () => {
- getGroups.mockImplementation(() => new Promise(() => {})); // Never resolves
-
- const { getByTestId } = renderWithAuthContext();
-
- expect(getByTestId('loading-indicator')).toBeTruthy();
- });
-
- it('should fetch groups on mount when token is available', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group 1', joinCode: 'ABC123', icon: 'T' },
- ];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- await waitFor(() => {
- expect(getGroups).toHaveBeenCalledWith('mock-token-123');
- });
- });
-
- it('should not fetch groups when token is not available', () => {
- const authValueWithoutToken = { ...mockAuthContextValue, token: null };
-
- renderWithAuthContext(authValueWithoutToken);
-
- expect(getGroups).not.toHaveBeenCalled();
- });
-
- it('should handle error when fetching groups fails', async () => {
- getGroups.mockRejectedValue(new Error('Network error'));
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- await waitFor(() => {
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch groups.');
- });
- });
-
- it('should set loading to false after groups are fetched', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' },
- ];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { queryByTestId } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(queryByTestId('loading-indicator')).toBeNull();
- });
- });
- });
-
- describe('Settlement Status Calculations', () => {
- it('should calculate settlement status when user owes money', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
- { fromUserId: 'user789', toUserId: 'user123', amount: 20 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- await waitFor(() => {
- expect(getOptimizedSettlements).toHaveBeenCalledWith('mock-token-123', 'group1');
- });
- });
-
- it('should calculate settlement status when user is owed money', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user456', toUserId: 'user123', amount: 75 },
- { fromUserId: 'user123', toUserId: 'user789', amount: 25 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- await waitFor(() => {
- expect(getOptimizedSettlements).toHaveBeenCalledWith('mock-token-123', 'group1');
- });
- });
-
- it('should handle settlement calculation error gracefully', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockRejectedValue(new Error('Settlement error'));
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- await waitFor(() => {
- expect(mockConsoleError).toHaveBeenCalledWith(
- 'Failed to fetch settlement status for group:',
- 'group1',
- expect.any(Error)
- );
- });
- });
-
- it('should calculate correct net balance for complex settlements', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 30 },
- { fromUserId: 'user456', toUserId: 'user123', amount: 50 },
- { fromUserId: 'user789', toUserId: 'user123', amount: 25 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- // Net balance: (50 + 25) - 30 = 45, so user is owed $45
- expect(getByText('You are owed $45.00.')).toBeTruthy();
- });
- });
-
- it('should handle settlements with undefined amounts', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: undefined },
- { fromUserId: 'user456', toUserId: 'user123', amount: null },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('✓ You are settled up.')).toBeTruthy();
- });
- });
- });
-
- describe('Group Rendering and UI', () => {
- it('should render groups list when data is loaded', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group 1', joinCode: 'ABC123', icon: 'T' },
- { _id: 'group2', name: 'Test Group 2', joinCode: 'XYZ789', icon: 'G' },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('Test Group 1')).toBeTruthy();
- expect(getByText('Test Group 2')).toBeTruthy();
- expect(getByText('Join Code: ABC123')).toBeTruthy();
- expect(getByText('Join Code: XYZ789')).toBeTruthy();
- });
- });
-
- it('should display empty state when no groups exist', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('No groups found. Create or join one!')).toBeTruthy();
- });
- });
-
- it('should navigate to group details when group card is pressed', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group', joinCode: 'ABC123', icon: 'T' },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const groupCard = getByText('Test Group');
- fireEvent.press(groupCard);
- });
-
- expect(mockNavigation.navigate).toHaveBeenCalledWith('GroupDetails', {
- groupId: 'group1',
- groupName: 'Test Group',
- groupIcon: 'T',
- });
- });
-
- it('should render group avatar with icon when provided', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group', joinCode: 'ABC123', icon: '🏠' },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('🏠')).toBeTruthy();
- });
- });
-
- it('should render group avatar with first letter when no icon provided', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }, // No icon
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('T')).toBeTruthy(); // First letter of "Test Group"
- });
- });
- });
-
- describe('Settlement Status Display', () => {
- it('should display "Calculating balances..." when settlement status is loading', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- // Delay the settlement response to simulate loading
- getOptimizedSettlements.mockImplementation(() => new Promise(resolve =>
- setTimeout(() => resolve({ data: { optimizedSettlements: [] } }), 100)
- ));
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('Calculating balances...')).toBeTruthy();
- });
- });
-
- it('should display settled status correctly', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('✓ You are settled up.')).toBeTruthy();
- });
- });
-
- it('should display owed amount with correct formatting', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user456', toUserId: 'user123', amount: 50.755 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('You are owed $50.76.')).toBeTruthy(); // Rounded to 2 decimal places
- });
- });
-
- it('should display owing amount with correct formatting', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 25.504 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('You owe $25.50.')).toBeTruthy(); // Rounded to 2 decimal places
- });
- });
-
- it('should handle zero net balance as settled', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 50 },
- { fromUserId: 'user456', toUserId: 'user123', amount: 50 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('You are settled up.')).toBeTruthy();
- });
- });
- });
-
- describe('Create Group Modal', () => {
- it('should show modal when plus icon is pressed', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const plusButton = getByLabelText('plus');
- fireEvent.press(plusButton);
- });
-
- expect(getByText('Create a New Group')).toBeTruthy();
- });
-
- it('should update group name input when text changes', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByDisplayValue } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, 'New Test Group');
-
- expect(getByDisplayValue('New Test Group')).toBeTruthy();
- });
-
- it('should show error when creating group without name', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- fireEvent.press(getByText('Create'));
-
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter a group name.');
- });
-
- it('should show error when creating group with empty name', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, ' '); // Whitespace only
- fireEvent.press(getByText('Create'));
-
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter a group name.');
- });
-
- it('should create group successfully and refresh list', async () => {
- const initialGroups = [];
- const updatedGroups = [{ _id: 'newgroup1', name: 'New Test Group', joinCode: 'NEW123' }];
-
- createGroup.mockResolvedValue({ data: { success: true } });
- getGroups
- .mockResolvedValueOnce({ data: { groups: initialGroups } })
- .mockResolvedValueOnce({ data: { groups: updatedGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByLabelText, getByText, queryByText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, 'New Test Group');
-
- await act(async () => {
- fireEvent.press(getByText('Create'));
- });
-
- expect(createGroup).toHaveBeenCalledWith('mock-token-123', 'New Test Group');
-
- // Modal should be hidden
- await waitFor(() => {
- expect(queryByText('Create a New Group')).toBeNull();
- });
-
- // Groups list should be refreshed
- expect(getGroups).toHaveBeenCalledTimes(2);
- });
-
- it('should handle group creation error', async () => {
- createGroup.mockRejectedValue(new Error('Creation failed'));
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, 'New Test Group');
-
- await act(async () => {
- fireEvent.press(getByText('Create'));
- });
-
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to create group.');
- });
-
- it('should show loading state while creating group', async () => {
- let resolveCreate;
- createGroup.mockImplementation(() => new Promise(resolve => {
- resolveCreate = resolve;
- }));
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, 'New Test Group');
-
- act(() => {
- fireEvent.press(getByText('Create'));
- });
-
- // Button should be disabled and show loading
- const createButton = getByText('Create');
- expect(createButton.props.disabled).toBeTruthy();
-
- // Resolve the creation
- act(() => {
- resolveCreate({ data: { success: true } });
- });
- });
-
- it('should clear input after successful group creation', async () => {
- createGroup.mockResolvedValue({ data: { success: true } });
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText, getByText, queryByDisplayValue } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('plus'));
- });
-
- const input = getByLabelText('Group Name');
- fireEvent.changeText(input, 'New Test Group');
-
- await act(async () => {
- fireEvent.press(getByText('Create'));
- });
-
- // After successful creation, input should be cleared
- await waitFor(() => {
- expect(queryByDisplayValue('New Test Group')).toBeNull();
- });
- });
- });
-
- describe('Navigation Actions', () => {
- it('should navigate to JoinGroup screen with callback when account-plus icon is pressed', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('account-plus'));
- });
-
- expect(mockNavigation.navigate).toHaveBeenCalledWith('JoinGroup', {
- onGroupJoined: expect.any(Function),
- });
- });
-
- it('should provide fetchGroups as callback to JoinGroup screen', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { getByLabelText } = renderWithAuthContext();
-
- await waitFor(() => {
- fireEvent.press(getByLabelText('account-plus'));
- });
-
- const navigateCall = mockNavigation.navigate.mock.calls[0];
- const callback = navigateCall[1].onGroupJoined;
-
- // Calling the callback should trigger fetchGroups
- await act(async () => {
- await callback();
- });
-
- // Should have been called twice - once on mount, once from callback
- expect(getGroups).toHaveBeenCalledTimes(2);
- });
- });
-
- describe('Pull to Refresh', () => {
- it('should refresh groups when pull to refresh is triggered', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByTestId } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getGroups).toHaveBeenCalledTimes(1);
- });
-
- // Simulate pull to refresh
- const flatList = getByTestId('groups-flatlist');
- await act(async () => {
- fireEvent(flatList, 'onRefresh');
- });
-
- expect(getGroups).toHaveBeenCalledTimes(2);
- });
-
- it('should show refreshing indicator during pull to refresh', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- let resolveRefresh;
- getGroups
- .mockResolvedValueOnce({ data: { groups: mockGroups } })
- .mockImplementationOnce(() => new Promise(resolve => {
- resolveRefresh = resolve;
- }));
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByTestId } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getGroups).toHaveBeenCalledTimes(1);
- });
-
- const flatList = getByTestId('groups-flatlist');
- act(() => {
- fireEvent(flatList, 'onRefresh');
- });
-
- // Should show refreshing state
- expect(flatList.props.refreshing).toBeTruthy();
-
- // Resolve the refresh
- act(() => {
- resolveRefresh({ data: { groups: mockGroups } });
- });
- });
- });
-
- describe('Edge Cases and Error Handling', () => {
- it('should handle missing user ID when calculating settlements', async () => {
- const authValueWithoutUserId = {
- ...mockAuthContextValue,
- user: null,
- };
-
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
-
- await act(async () => {
- renderWithAuthContext(authValueWithoutUserId);
- });
-
- // Should not call getOptimizedSettlements when user ID is not available
- expect(getOptimizedSettlements).not.toHaveBeenCalled();
- });
-
- it('should handle user object without _id property', async () => {
- const authValueWithIncompleteUser = {
- ...mockAuthContextValue,
- user: { name: 'Test User' }, // Missing _id
- };
-
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
-
- await act(async () => {
- renderWithAuthContext(authValueWithIncompleteUser);
- });
-
- expect(getOptimizedSettlements).not.toHaveBeenCalled();
- });
-
- it('should handle groups with missing properties gracefully', async () => {
- const mockGroups = [
- { _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }, // No icon
- { _id: 'group2', name: '', joinCode: 'XYZ789', icon: 'T' }, // Empty name
- { _id: 'group3', name: 'Group 3' }, // No joinCode
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText, queryByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('Test Group')).toBeTruthy();
- expect(getByText('Join Code: ABC123')).toBeTruthy();
- expect(queryByText('Join Code: undefined')).toBeNull();
- });
- });
-
- it('should handle malformed API response for groups', async () => {
- getGroups.mockResolvedValue({ data: {} }); // Missing groups array
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- // Should handle gracefully without crashing
- expect(mockConsoleError).toHaveBeenCalled();
- });
-
- it('should handle malformed API response for settlements', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: {} }); // Missing optimizedSettlements
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getByText('✓ You are settled up.')).toBeTruthy();
- });
- });
-
- it('should handle network timeout errors', async () => {
- const timeoutError = new Error('Network timeout');
- timeoutError.code = 'ECONNABORTED';
- getGroups.mockRejectedValue(timeoutError);
-
- await act(async () => {
- renderWithAuthContext();
- });
-
- expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to fetch groups.');
- });
-
- it('should handle empty group names', async () => {
- const mockGroups = [
- { _id: 'group1', name: '', joinCode: 'ABC123' },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- // Should still display something for the group
- expect(getByText('Join Code: ABC123')).toBeTruthy();
- });
- });
- });
-
- describe('Status Color Logic', () => {
- it('should apply green color for settled status', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: [] } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const statusText = getByText('✓ You are settled up.');
- expect(statusText.props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({ color: '#4CAF50' })
- ])
- );
- });
- });
-
- it('should apply red color when user owes money', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user123', toUserId: 'user456', amount: 25 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const statusText = getByText('You owe $25.00.');
- expect(statusText.props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({ color: '#F44336' })
- ])
- );
- });
- });
-
- it('should apply green color when user is owed money', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- const mockSettlements = [
- { fromUserId: 'user456', toUserId: 'user123', amount: 25 },
- ];
-
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- getOptimizedSettlements.mockResolvedValue({ data: { optimizedSettlements: mockSettlements } });
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const statusText = getByText('You are owed $25.00.');
- expect(statusText.props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({ color: '#4CAF50' })
- ])
- );
- });
- });
-
- it('should apply default green color for calculating status', async () => {
- const mockGroups = [{ _id: 'group1', name: 'Test Group', joinCode: 'ABC123' }];
- getGroups.mockResolvedValue({ data: { groups: mockGroups } });
- // Don't resolve settlements to keep it in calculating state
-
- const { getByText } = renderWithAuthContext();
-
- await waitFor(() => {
- const statusText = getByText('Calculating balances...');
- expect(statusText.props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({ color: '#4CAF50' })
- ])
- );
- });
- });
- });
-
- describe('Component Lifecycle', () => {
- it('should fetch groups when token changes from null to valid', async () => {
- const { rerender } = render(
-
-
-
- );
-
- expect(getGroups).not.toHaveBeenCalled();
-
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- rerender(
-
-
-
- );
-
- await waitFor(() => {
- expect(getGroups).toHaveBeenCalledWith('mock-token-123');
- });
- });
-
- it('should not refetch groups when token changes to same value', async () => {
- getGroups.mockResolvedValue({ data: { groups: [] } });
-
- const { rerender } = renderWithAuthContext();
-
- await waitFor(() => {
- expect(getGroups).toHaveBeenCalledTimes(1);
- });
-
- // Re-render with same token
- rerender(
-
-
-
- );
-
- // Should not call again
- expect(getGroups).toHaveBeenCalledTimes(1);
- });
- });
-});
\ No newline at end of file
diff --git a/frontend/utils/balanceCalculator.test.js b/frontend/utils/balanceCalculator.test.js
deleted file mode 100644
index 138fc7d5..00000000
--- a/frontend/utils/balanceCalculator.test.js
+++ /dev/null
@@ -1,815 +0,0 @@
-/**
- * Comprehensive unit tests for balanceCalculator utility functions
- * Testing framework: Jest (based on ES6 modules and common Node.js patterns)
- */
-
-import balanceCalculatorModule, { calculateFriendBalances, safeGet, validateGroupData, getMemberName } from './balanceCalculator';
-
-describe('balanceCalculator', () => {
- describe('safeGet', () => {
- it('should return value for valid path', () => {
- const obj = { user: { name: 'John', age: 30 } };
- expect(safeGet(obj, 'user.name')).toBe('John');
- expect(safeGet(obj, 'user.age')).toBe(30);
- });
-
- it('should return default value for invalid path', () => {
- const obj = { user: { name: 'John' } };
- expect(safeGet(obj, 'user.email', 'default')).toBe('default');
- expect(safeGet(obj, 'nonexistent.path', 'fallback')).toBe('fallback');
- });
-
- it('should return null as default when no default value provided', () => {
- const obj = { user: { name: 'John' } };
- expect(safeGet(obj, 'user.email')).toBeNull();
- });
-
- it('should handle null/undefined objects gracefully', () => {
- expect(safeGet(null, 'any.path', 'default')).toBe('default');
- expect(safeGet(undefined, 'any.path', 'default')).toBe('default');
- expect(safeGet('not an object', 'any.path', 'default')).toBe('default');
- expect(safeGet(123, 'any.path', 'default')).toBe('default');
- expect(safeGet(true, 'any.path', 'default')).toBe('default');
- });
-
- it('should handle empty path', () => {
- const obj = { value: 'test' };
- expect(safeGet(obj, '', 'default')).toBe('default');
- });
-
- it('should handle null/undefined values in path', () => {
- const obj = { user: null };
- expect(safeGet(obj, 'user.name', 'default')).toBe('default');
-
- const obj2 = { user: { profile: undefined } };
- expect(safeGet(obj2, 'user.profile.name', 'default')).toBe('default');
- });
-
- it('should handle deep nested paths', () => {
- const obj = { a: { b: { c: { d: { e: 'deep value' } } } } };
- expect(safeGet(obj, 'a.b.c.d.e')).toBe('deep value');
- expect(safeGet(obj, 'a.b.c.d.f', 'missing')).toBe('missing');
- });
-
- it('should handle array indices in path', () => {
- const obj = { items: [{ name: 'first' }, { name: 'second' }] };
- expect(safeGet(obj, 'items.0.name')).toBe('first');
- expect(safeGet(obj, 'items.1.name')).toBe('second');
- expect(safeGet(obj, 'items.2.name', 'not found')).toBe('not found');
- });
-
- it('should return default value when final value is null or undefined', () => {
- const obj = { user: { name: null, email: undefined } };
- expect(safeGet(obj, 'user.name', 'default')).toBe('default');
- expect(safeGet(obj, 'user.email', 'default')).toBe('default');
- });
-
- it('should handle non-object intermediate values', () => {
- const obj = { user: 'string value' };
- expect(safeGet(obj, 'user.name', 'default')).toBe('default');
-
- const obj2 = { user: { profile: 123 } };
- expect(safeGet(obj2, 'user.profile.name', 'default')).toBe('default');
- });
-
- it('should handle boolean values correctly', () => {
- const obj = { settings: { enabled: false, debug: true } };
- expect(safeGet(obj, 'settings.enabled')).toBe(false);
- expect(safeGet(obj, 'settings.debug')).toBe(true);
- });
-
- it('should handle zero values correctly', () => {
- const obj = { count: 0, balance: 0.0 };
- expect(safeGet(obj, 'count')).toBe(0);
- expect(safeGet(obj, 'balance')).toBe(0.0);
- });
- });
-
- describe('validateGroupData', () => {
- const validGroupData = {
- id: 'group123',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'User One' } }] },
- { data: { expenses: [{ id: 'exp1', amount: 100 }] } }
- ]
- };
-
- it('should validate and return correct group data', () => {
- const result = validateGroupData(validGroupData);
- expect(result).toEqual({
- id: 'group123',
- name: 'Test Group',
- members: [{ userId: 'user1', user: { name: 'User One' } }],
- expenses: [{ id: 'exp1', amount: 100 }]
- });
- });
-
- it('should return null for null/undefined input', () => {
- expect(validateGroupData(null)).toBeNull();
- expect(validateGroupData(undefined)).toBeNull();
- expect(validateGroupData('not an object')).toBeNull();
- expect(validateGroupData(123)).toBeNull();
- expect(validateGroupData([])).toBeNull();
- });
-
- it('should return null when details is not an array', () => {
- const invalidGroup = { ...validGroupData, details: null };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const invalidGroup2 = { ...validGroupData, details: 'not an array' };
- expect(validateGroupData(invalidGroup2)).toBeNull();
-
- const invalidGroup3 = { ...validGroupData, details: {} };
- expect(validateGroupData(invalidGroup3)).toBeNull();
- });
-
- it('should return null when details has less than 2 elements', () => {
- const invalidGroup = { ...validGroupData, details: [{ data: [] }] };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const emptyDetails = { ...validGroupData, details: [] };
- expect(validateGroupData(emptyDetails)).toBeNull();
- });
-
- it('should return null when members data is not an array', () => {
- const invalidGroup = {
- ...validGroupData,
- details: [
- { data: 'not an array' },
- { data: { expenses: [] } }
- ]
- };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const invalidGroup2 = {
- ...validGroupData,
- details: [
- { data: null },
- { data: { expenses: [] } }
- ]
- };
- expect(validateGroupData(invalidGroup2)).toBeNull();
- });
-
- it('should return null when expenses data is not an array', () => {
- const invalidGroup = {
- ...validGroupData,
- details: [
- { data: [] },
- { data: { expenses: 'not an array' } }
- ]
- };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const invalidGroup2 = {
- ...validGroupData,
- details: [
- { data: [] },
- { data: { expenses: null } }
- ]
- };
- expect(validateGroupData(invalidGroup2)).toBeNull();
- });
-
- it('should handle missing members response data', () => {
- const invalidGroup = {
- ...validGroupData,
- details: [
- { notData: [] },
- { data: { expenses: [] } }
- ]
- };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const invalidGroup2 = {
- ...validGroupData,
- details: [
- {},
- { data: { expenses: [] } }
- ]
- };
- expect(validateGroupData(invalidGroup2)).toBeNull();
- });
-
- it('should handle missing expenses response data', () => {
- const invalidGroup = {
- ...validGroupData,
- details: [
- { data: [] },
- { data: { notExpenses: [] } }
- ]
- };
- expect(validateGroupData(invalidGroup)).toBeNull();
-
- const invalidGroup2 = {
- ...validGroupData,
- details: [
- { data: [] },
- { data: {} }
- ]
- };
- expect(validateGroupData(invalidGroup2)).toBeNull();
- });
-
- it('should use _id as fallback when id is missing', () => {
- const groupWithUnderscore = {
- ...validGroupData,
- _id: 'group456'
- };
- delete groupWithUnderscore.id;
-
- const result = validateGroupData(groupWithUnderscore);
- expect(result.id).toBe('group456');
- });
-
- it('should use default name when name is missing', () => {
- const groupWithoutName = { ...validGroupData };
- delete groupWithoutName.name;
-
- const result = validateGroupData(groupWithoutName);
- expect(result.name).toBe('Unknown Group');
- });
-
- it('should handle missing details property', () => {
- const groupWithoutDetails = { id: 'group1', name: 'Test' };
- expect(validateGroupData(groupWithoutDetails)).toBeNull();
- });
-
- it('should handle empty members and expenses arrays', () => {
- const groupWithEmptyArrays = {
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [] },
- { data: { expenses: [] } }
- ]
- };
-
- const result = validateGroupData(groupWithEmptyArrays);
- expect(result).toEqual({
- id: 'group1',
- name: 'Test Group',
- members: [],
- expenses: []
- });
- });
- });
-
- describe('getMemberName', () => {
- const members = [
- { userId: 'user1', user: { name: 'Alice' } },
- { userId: 'user2', user: { name: 'Bob' } },
- { userId: 'user3', user: { name: null } },
- { userId: 'user4' }, // Missing user object
- { userId: 'user5', user: {} }, // Empty user object
- { userId: 'user6', user: { name: '' } } // Empty name
- ];
-
- it('should return correct member name', () => {
- expect(getMemberName(members, 'user1')).toBe('Alice');
- expect(getMemberName(members, 'user2')).toBe('Bob');
- });
-
- it('should return "Unknown" for non-existent userId', () => {
- expect(getMemberName(members, 'nonexistent')).toBe('Unknown');
- });
-
- it('should return "Unknown" for null/undefined userId', () => {
- expect(getMemberName(members, null)).toBe('Unknown');
- expect(getMemberName(members, undefined)).toBe('Unknown');
- expect(getMemberName(members, '')).toBe('Unknown');
- });
-
- it('should return "Unknown" for invalid members array', () => {
- expect(getMemberName(null, 'user1')).toBe('Unknown');
- expect(getMemberName(undefined, 'user1')).toBe('Unknown');
- expect(getMemberName('not an array', 'user1')).toBe('Unknown');
- expect(getMemberName({}, 'user1')).toBe('Unknown');
- expect(getMemberName(123, 'user1')).toBe('Unknown');
- });
-
- it('should return "Unknown" when member has no name', () => {
- expect(getMemberName(members, 'user3')).toBe('Unknown');
- expect(getMemberName(members, 'user4')).toBe('Unknown');
- expect(getMemberName(members, 'user5')).toBe('Unknown');
- });
-
- it('should return "Unknown" for empty name', () => {
- expect(getMemberName(members, 'user6')).toBe('Unknown');
- });
-
- it('should handle empty members array', () => {
- expect(getMemberName([], 'user1')).toBe('Unknown');
- });
-
- it('should handle members with invalid structure', () => {
- const invalidMembers = [
- null,
- 'invalid member',
- { userId: 'user1' },
- { user: { name: 'No UserId' } }
- ];
-
- expect(getMemberName(invalidMembers, 'user1')).toBe('Unknown');
- expect(getMemberName(invalidMembers, 'nonexistent')).toBe('Unknown');
- });
- });
-
- describe('calculateFriendBalances', () => {
- const mockGroupsWithDetails = [
- {
- id: 'group1',
- name: 'Test Group 1',
- details: [
- {
- data: [
- { userId: 'user1', user: { name: 'Alice' } },
- { userId: 'user2', user: { name: 'Bob' } },
- { userId: 'currentUser', user: { name: 'Current User' } }
- ]
- },
- {
- data: {
- expenses: [
- {
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- { userId: 'user1', amount: 50 },
- { userId: 'user2', amount: 30 }
- ]
- },
- {
- id: 'exp2',
- paidBy: 'user1',
- splits: [
- { userId: 'currentUser', amount: 20 }
- ]
- }
- ]
- }
- }
- ]
- }
- ];
-
- it('should calculate balances correctly when current user paid', () => {
- const result = calculateFriendBalances(mockGroupsWithDetails, 'currentUser');
-
- const aliceBalance = result.find(friend => friend.id === 'user1');
- const bobBalance = result.find(friend => friend.id === 'user2');
-
- expect(aliceBalance).toBeDefined();
- expect(aliceBalance.netBalance).toBe(30); // owes 50 from exp1, paid 20 for currentUser in exp2
- expect(aliceBalance.groups[0].balance).toBe(30);
-
- expect(bobBalance).toBeDefined();
- expect(bobBalance.netBalance).toBe(30); // owes 30 from exp1
- expect(bobBalance.groups[0].balance).toBe(30);
- });
-
- it('should handle invalid input gracefully', () => {
- expect(calculateFriendBalances(null, 'currentUser')).toEqual([]);
- expect(calculateFriendBalances(undefined, 'currentUser')).toEqual([]);
- expect(calculateFriendBalances([], null)).toEqual([]);
- expect(calculateFriendBalances([], undefined)).toEqual([]);
- expect(calculateFriendBalances('not an array', 'currentUser')).toEqual([]);
- expect(calculateFriendBalances({}, 'currentUser')).toEqual([]);
- expect(calculateFriendBalances([], '')).toEqual([]);
- });
-
- it('should skip invalid group data', () => {
- const invalidGroups = [
- null,
- { invalid: 'group' },
- { details: [] },
- 'invalid group',
- 123
- ];
-
- const result = calculateFriendBalances(invalidGroups, 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should handle expenses with createdBy fallback', () => {
- const groupsWithCreatedBy = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- createdBy: 'currentUser', // No paidBy field
- splits: [{ userId: 'user1', amount: 50 }]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(groupsWithCreatedBy, 'currentUser');
- const aliceBalance = result.find(friend => friend.id === 'user1');
-
- expect(aliceBalance.netBalance).toBe(50);
- });
-
- it('should handle zero and negative amounts', () => {
- const groupsWithZeroAmounts = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- { userId: 'user1', amount: 0 },
- { userId: 'user1', amount: -10 },
- { userId: 'user1', amount: 'invalid' },
- { userId: 'user1', amount: NaN },
- { userId: 'user1', amount: null }
- ]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(groupsWithZeroAmounts, 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should not create balance entries when payer owes themselves', () => {
- const selfPayingGroups = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'currentUser', user: { name: 'Current User' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [{ userId: 'currentUser', amount: 50 }]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(selfPayingGroups, 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should handle multiple groups correctly', () => {
- const multipleGroups = [
- {
- id: 'group1',
- name: 'Group 1',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [{ userId: 'user1', amount: 30 }]
- }]
- }
- }
- ]
- },
- {
- id: 'group2',
- name: 'Group 2',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp2',
- paidBy: 'currentUser',
- splits: [{ userId: 'user1', amount: 20 }]
- }]
- }
- }
- ]
- }
- ];
-
- const result = calculateFriendBalances(multipleGroups, 'currentUser');
- const aliceBalance = result.find(friend => friend.id === 'user1');
-
- expect(aliceBalance.netBalance).toBe(50); // 30 + 20
- expect(aliceBalance.groups).toHaveLength(2);
- expect(aliceBalance.groups.find(g => g.id === 'group1').balance).toBe(30);
- expect(aliceBalance.groups.find(g => g.id === 'group2').balance).toBe(20);
- });
-
- it('should handle missing or invalid expense data', () => {
- const invalidExpenseGroups = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [] },
- {
- data: {
- expenses: [
- null,
- { id: 'exp1' }, // Missing required fields
- { id: 'exp2', paidBy: 'user1' }, // Missing splits
- { id: 'exp3', splits: [] }, // Missing paidBy
- 'invalid expense',
- { id: 'exp4', paidBy: '', splits: [] }, // Empty paidBy
- { id: 'exp5', paidBy: null, splits: [{ userId: 'user1', amount: 50 }] }
- ]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(invalidExpenseGroups, 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should handle missing split data', () => {
- const invalidSplitGroups = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- null,
- 'invalid split',
- { userId: 'user1' }, // Missing amount
- { amount: 50 }, // Missing userId
- { userId: '', amount: 30 }, // Empty userId
- { userId: null, amount: 25 }, // Null userId
- { userId: 'user1', amount: undefined } // Undefined amount
- ]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(invalidSplitGroups, 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should log warnings for invalid input', () => {
- const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
-
- calculateFriendBalances(null, 'currentUser');
- expect(consoleSpy).toHaveBeenCalledWith('Invalid input to calculateFriendBalances:', { groupsWithDetails: null, currentUserId: 'currentUser' });
-
- calculateFriendBalances([], null);
- expect(consoleSpy).toHaveBeenCalledWith('Invalid input to calculateFriendBalances:', { groupsWithDetails: [], currentUserId: null });
-
- consoleSpy.mockRestore();
- });
-
- it('should log warnings for invalid group data', () => {
- const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
-
- const invalidGroup = { invalid: 'data' };
- calculateFriendBalances([invalidGroup], 'currentUser');
- expect(consoleSpy).toHaveBeenCalledWith('Invalid group data, skipping:', invalidGroup);
-
- consoleSpy.mockRestore();
- });
-
- it('should format output correctly for UI consumption', () => {
- const result = calculateFriendBalances(mockGroupsWithDetails, 'currentUser');
-
- expect(Array.isArray(result)).toBe(true);
- result.forEach(friend => {
- expect(friend).toHaveProperty('id');
- expect(friend).toHaveProperty('name');
- expect(friend).toHaveProperty('netBalance');
- expect(friend).toHaveProperty('groups');
- expect(Array.isArray(friend.groups)).toBe(true);
- expect(typeof friend.netBalance).toBe('number');
- expect(friend.id).toBeTruthy();
-
- friend.groups.forEach(group => {
- expect(group).toHaveProperty('id');
- expect(group).toHaveProperty('name');
- expect(group).toHaveProperty('balance');
- expect(typeof group.balance).toBe('number');
- expect(group.id).toBeTruthy();
- });
- });
- });
-
- it('should handle complex balance calculations across multiple expenses', () => {
- const complexGroups = [{
- id: 'group1',
- name: 'Complex Group',
- details: [
- {
- data: [
- { userId: 'user1', user: { name: 'Alice' } },
- { userId: 'user2', user: { name: 'Bob' } },
- { userId: 'currentUser', user: { name: 'Current User' } }
- ]
- },
- {
- data: {
- expenses: [
- {
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- { userId: 'user1', amount: 50 },
- { userId: 'user2', amount: 30 }
- ]
- },
- {
- id: 'exp2',
- paidBy: 'user1',
- splits: [
- { userId: 'currentUser', amount: 40 },
- { userId: 'user2', amount: 20 }
- ]
- },
- {
- id: 'exp3',
- paidBy: 'user2',
- splits: [
- { userId: 'currentUser', amount: 15 },
- { userId: 'user1', amount: 25 }
- ]
- }
- ]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(complexGroups, 'currentUser');
-
- // Alice: owes 50 from exp1, gets 40 from exp2 = net 10 (Alice owes currentUser)
- const aliceBalance = result.find(friend => friend.id === 'user1');
- expect(aliceBalance?.netBalance).toBe(10); // 50 - 40 = 10
-
- // Bob: owes 30 from exp1, owes 20 from exp2, gets 15 from exp3 = net 35 (Bob owes currentUser)
- const bobBalance = result.find(friend => friend.id === 'user2');
- expect(bobBalance?.netBalance).toBe(35); // 30 + 20 - 15 = 35
- });
-
- it('should handle string amounts by parsing them', () => {
- const groupsWithStringAmounts = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- { userId: 'user1', amount: '50.75' },
- { userId: 'user1', amount: '25.25' }
- ]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(groupsWithStringAmounts, 'currentUser');
- const aliceBalance = result.find(friend => friend.id === 'user1');
-
- expect(aliceBalance?.netBalance).toBe(76); // 50.75 + 25.25
- });
-
- it('should handle decimal amounts correctly', () => {
- const groupsWithDecimals = [{
- id: 'group1',
- name: 'Test Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- {
- data: {
- expenses: [{
- id: 'exp1',
- paidBy: 'currentUser',
- splits: [
- { userId: 'user1', amount: 33.33 },
- { userId: 'user1', amount: 16.67 }
- ]
- }]
- }
- }
- ]
- }];
-
- const result = calculateFriendBalances(groupsWithDecimals, 'currentUser');
- const aliceBalance = result.find(friend => friend.id === 'user1');
-
- expect(aliceBalance?.netBalance).toBe(50); // 33.33 + 16.67
- });
-
- it('should handle empty groups array', () => {
- const result = calculateFriendBalances([], 'currentUser');
- expect(result).toEqual([]);
- });
-
- it('should handle groups with no expenses', () => {
- const groupsWithNoExpenses = [{
- id: 'group1',
- name: 'Empty Group',
- details: [
- { data: [{ userId: 'user1', user: { name: 'Alice' } }] },
- { data: { expenses: [] } }
- ]
- }];
-
- const result = calculateFriendBalances(groupsWithNoExpenses, 'currentUser');
- expect(result).toEqual([]);
- });
- });
-
- describe('default export', () => {
- it('should export all functions in default object', () => {
- expect(balanceCalculatorModule).toHaveProperty('calculateFriendBalances');
- expect(balanceCalculatorModule).toHaveProperty('safeGet');
- expect(balanceCalculatorModule).toHaveProperty('validateGroupData');
- expect(balanceCalculatorModule).toHaveProperty('getMemberName');
- });
-
- it('should have working functions in default export', () => {
- const obj = { test: { value: 'works' } };
- expect(balanceCalculatorModule.safeGet(obj, 'test.value')).toBe('works');
- });
- });
-
- describe('edge cases and error handling', () => {
- it('should handle circular references gracefully', () => {
- const circularObj = {};
- circularObj.self = circularObj;
-
- expect(safeGet(circularObj, 'self.self.self', 'default')).toBe('default');
- });
-
- it('should handle very deep nesting', () => {
- const deepObj = { level1: { level2: { level3: { level4: { level5: 'deep' } } } } };
- expect(safeGet(deepObj, 'level1.level2.level3.level4.level5')).toBe('deep');
- expect(safeGet(deepObj, 'level1.level2.level3.level4.level6', 'not found')).toBe('not found');
- });
-
- it('should handle special characters in object keys', () => {
- const specialObj = { 'key-with-dash': { 'key.with.dots': 'value' } };
- expect(safeGet(specialObj, 'key-with-dash.key.with.dots')).toBe('value');
- });
-
- it('should handle numeric string keys', () => {
- const numericObj = { '123': { '456': 'numeric keys' } };
- expect(safeGet(numericObj, '123.456')).toBe('numeric keys');
- });
-
- it('should handle prototype pollution attempts', () => {
- const maliciousObj = { '__proto__': { polluted: 'value' } };
- expect(safeGet(maliciousObj, '__proto__.polluted')).toBe('value');
- expect(safeGet({}, 'polluted', 'safe')).toBe('safe'); // Should not be polluted
- });
-
- it('should handle large datasets without performance issues', () => {
- const largeGroups = Array.from({ length: 100 }, (_, i) => ({
- id: `group${i}`,
- name: `Group ${i}`,
- details: [
- { data: Array.from({ length: 50 }, (_, j) => ({ userId: `user${j}`, user: { name: `User ${j}` } })) },
- {
- data: {
- expenses: Array.from({ length: 100 }, (_, k) => ({
- id: `exp${k}`,
- paidBy: 'currentUser',
- splits: [{ userId: `user${k % 50}`, amount: Math.random() * 100 }]
- }))
- }
- }
- ]
- }));
-
- const startTime = Date.now();
- const result = calculateFriendBalances(largeGroups, 'currentUser');
- const endTime = Date.now();
-
- expect(endTime - startTime).toBeLessThan(5000); // Should complete within 5 seconds
- expect(Array.isArray(result)).toBe(true);
- });
- });
-});
\ No newline at end of file