Summary
Several tests are currently skipped or broken, leaving critical error handling paths untested.
Related to: #154 (Daily Codebase Review - 2025-12-16)
Problem
1. Skipped Test in Onboarding
File: __tests__/app/onboarding.test.tsx:639-641
// TODO: Fix this test - the mock upsert isn't being called for unknown reasons
// after migrating from update() to upsert()
it.skip('shows error alert when profile update fails', async () => {
Issue: After migrating from update() to upsert(), the mock setup stopped working. The test was skipped instead of fixed.
Impact: Error handling for profile update failures is not validated.
2. Broken Analytics Tests in AppleSignInButton
File: __tests__/components/auth/AppleSignInButton.test.tsx:1274,1324
// TODO: Fix these tests - they were added by CodeRabbit but are not working
// The async flow is not completing properly. Need to investigate mock setup.
Affected test suites:
- "Analytics tracking edge cases" (lines 1276-1318)
- "Profile update edge cases" (lines 1326+)
Issue: Async flows are not completing properly due to mock setup issues.
Impact: Apple Sign-In analytics tracking and profile update edge cases are not tested.
Root Cause Analysis
Onboarding Test
The migration from .update() to .upsert() changed how Supabase client methods are called. The mock needs to be updated:
// Current mock (not working)
supabase.from('profiles').update().eq().select().single.mockResolvedValueOnce({ ... });
// Likely needed
supabase.from('profiles').upsert().select().single.mockResolvedValueOnce({ ... });
AppleSignInButton Tests
The async completion issue likely stems from:
- Promise resolution timing
- Mock setup for
signInWithIdToken
- Analytics call verification timing
Acceptance Criteria
Priority
HIGH - Error handling and authentication edge cases should be tested
Files to Modify
__tests__/app/onboarding.test.tsx
__tests__/components/auth/AppleSignInButton.test.tsx
Estimated Effort
2-3 hours
Summary
Several tests are currently skipped or broken, leaving critical error handling paths untested.
Related to: #154 (Daily Codebase Review - 2025-12-16)
Problem
1. Skipped Test in Onboarding
File:
__tests__/app/onboarding.test.tsx:639-641Issue: After migrating from
update()toupsert(), the mock setup stopped working. The test was skipped instead of fixed.Impact: Error handling for profile update failures is not validated.
2. Broken Analytics Tests in AppleSignInButton
File:
__tests__/components/auth/AppleSignInButton.test.tsx:1274,1324Affected test suites:
Issue: Async flows are not completing properly due to mock setup issues.
Impact: Apple Sign-In analytics tracking and profile update edge cases are not tested.
Root Cause Analysis
Onboarding Test
The migration from
.update()to.upsert()changed how Supabase client methods are called. The mock needs to be updated:AppleSignInButton Tests
The async completion issue likely stems from:
signInWithIdTokenAcceptance Criteria
.skipfrom onboarding test and fix mock setuppnpm testPriority
HIGH - Error handling and authentication edge cases should be tested
Files to Modify
__tests__/app/onboarding.test.tsx__tests__/components/auth/AppleSignInButton.test.tsxEstimated Effort
2-3 hours