Skip to content

Commit 8b7d082

Browse files
ShivaniNRclaude
andcommitted
Add OTP email confirmation for mobile signups with auth test suite
Tags each signup with its origin so the Supabase email template can render the right confirmation surface per client, and wires the mobile side to consume a 6-digit OTP instead of relying on a web redirect. - Web and mobile signUp now pass signup_source ('web' / 'mobile') in options.data so the Supabase email template can branch via {{ if eq .Data.signup_source "mobile" }}. - New mobile VerifyOtpScreen: 6-digit numeric input with non-numeric filtering, verifyOtp({type: 'signup'}) on submit, inline error display, 30-second resend cooldown, and a back-to-signup link. - AuthNavigator registers VerifyOtp; SignUpScreen now navigates to it instead of showing the old alert and bouncing back to Login. Also lands a Jest + jest-expo + Testing Library setup with 32 tests across 5 suites (AuthContext, SignUpScreen, VerifyOtpScreen, LoginScreen, format util). The AuthContext suite includes an explicit assertion that signUp passes signup_source: 'mobile' — the exact regression the earlier "no code in email" debugging surfaced. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 8c58e71 commit 8b7d082

14 files changed

Lines changed: 3336 additions & 92 deletions

File tree

‎client/src/context/AuthContext.jsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function AuthProvider({ children }) {
4242
first_name: firstName,
4343
last_name: lastName,
4444
display_name: firstName,
45+
signup_source: 'web',
4546
},
4647
},
4748
});

‎mobile/jest.config.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
preset: 'jest-expo',
3+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
4+
testPathIgnorePatterns: ['/node_modules/', '/.expo/', '/.expo-export-check/'],
5+
testTimeout: 30000,
6+
};

‎mobile/jest.setup.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import '@testing-library/jest-native/extend-expect';
2+
3+
// Stable AsyncStorage mock so AuthContext init doesn't blow up under jsdom.
4+
jest.mock('@react-native-async-storage/async-storage', () =>
5+
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
6+
);

0 commit comments

Comments
 (0)