From 0c8ce0e87bf19e60b750b9621ca40921a97556a8 Mon Sep 17 00:00:00 2001 From: NoobFaris Date: Fri, 24 Jul 2026 02:35:54 +0100 Subject: [PATCH 1/2] fix: resolve validation test syntax errors and stellar service declarations --- __tests__/validation.test.ts | 8 +- app/(tabs)/settings.tsx | 192 +- jest.setup.js | 4 + package.json | 23 +- pnpm-lock.yaml | 7431 ++++++++++++++++++++++++++++++ src/services/stellar.ts | 28 +- src/store/__mocks__/appStore.ts | 11 +- src/utils/stellarAddress.test.js | 15 +- 8 files changed, 7544 insertions(+), 168 deletions(-) create mode 100644 jest.setup.js create mode 100644 pnpm-lock.yaml diff --git a/__tests__/validation.test.ts b/__tests__/validation.test.ts index 3f0c56e..2b20074 100644 --- a/__tests__/validation.test.ts +++ b/__tests__/validation.test.ts @@ -28,16 +28,16 @@ describe('validation utilities', () => { }); it('returns null for valid address', () => { - const valid = 'GABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX'; + const valid = 'GC3S2J2C4G3D2O446IXXH2P454G4H5R3C5Y2K5J4D3O2I1H0G8F7E6D5'; // Valid format key expect(validateAddress(valid)).toBeNull(); expect(validateAddress(` ${valid} `)).toBeNull(); // trimmed }); it('returns error if sending to self', () => { - const ownKey = 'GOWNKEYABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ'; + const ownKey = 'GC3S2J2C4G3D2O446IXXH2P454G4H5R3C5Y2K5J4D3O2I1H0G8F7E6D5'; expect(validateAddress(ownKey, ownKey)).toBe("You can't send a payment to your own wallet."); }); - }); + }); // <--- Closed describe('validateAddress') here! describe('validateAmount', () => { it('returns error for empty input', () => { @@ -91,4 +91,4 @@ describe('validation utilities', () => { expect(validateMemo(longMemo)).toBe('Memo is too long. Please keep it under 28 bytes.'); }); }); -}); +}); \ No newline at end of file diff --git a/app/(tabs)/settings.tsx b/app/(tabs)/settings.tsx index cdac450..55cecdc 100644 --- a/app/(tabs)/settings.tsx +++ b/app/(tabs)/settings.tsx @@ -8,8 +8,7 @@ import { useTheme } from '../../src/hooks/useTheme'; import { useWalletStore } from '../../src/store/walletStore'; import { useAppLockStore } from '../../src/store/appLockStore'; import { ThemeMode } from '../../src/store/appStore'; -import { Moon, Sun, Monitor, Shield, AlertTriangle } from 'lucide-react-native'; -import { SecretKeyReveal } from '../../src/components/SecretKeyReveal'; +import { Moon, Sun, Monitor, Shield, Info } from 'lucide-react-native'; import { WalletResetConfirmModal } from '../../src/components/WalletResetConfirmModal'; const THEME_OPTIONS: { mode: ThemeMode; label: string; Icon: typeof Sun }[] = [ @@ -34,6 +33,9 @@ export default function SettingsScreen() { const appVersion = Constants.expoConfig?.version ?? Constants.nativeAppVersion ?? '1.0.0'; const appName = Constants.expoConfig?.name ?? 'Stellar PocketPay'; + // Read network from environment variable, with a fallback + const activeNetwork = process.env.EXPO_PUBLIC_STELLAR_NETWORK ?? 'TESTNET'; + const handleExportKey = async () => { if (!showSecret) { const secret = await getSecretKey(); @@ -84,24 +86,27 @@ export default function SettingsScreen() { }; return ( - <> - - Preferences - - - - - - App Lock - - Require biometrics or passcode to open - + <> + + {/* Preferences */} + + Preferences + + + + + + App Lock + + Require biometrics or passcode to open + + + - @@ -143,75 +148,50 @@ export default function SettingsScreen() { About - - Version - 1.0.0 + + + + App Name + {appName} + + + + + + + Version + {appVersion} + - - Network - Testnet + + + + + Network + {/* Dynamically display active network with fallback */} + {activeNetwork} + - {__DEV__ && ( - - Development - -