brackt/app/routes/__tests__
Chris Parsons 215b0cf6b5
Add user onboarding flow with username selection (#430)
* Add username onboarding prompt for new signups

New users (especially via OAuth/Google) are redirected to /onboarding
to choose a display username before accessing the app. Adds unique
constraint on users.username and case-insensitive uniqueness validation.

https://claude.ai/code/session_01UinBMAy9d6dQzzbcUAdq8J

* Address all code review issues on username onboarding

- Replace case-sensitive unique constraint with functional unique index on
  lower(username) so DB-level uniqueness is case-insensitive (fix #1)
- Share USERNAME_RE from models/user.ts; add same format + uniqueness
  validation to the settings update-profile action (fix #2)
- Wrap updateUser calls in try/catch to handle race-condition DB errors
  gracefully in both onboarding and settings (fix #3)
- Add unit tests for suggestUsername, safeRedirectTo, USERNAME_RE, and
  isOnboardingExempt (fix #4)
- Guard suggestUsername against returning strings shorter than 3 chars (fix #5)
- Preserve the user's intended destination via redirectTo query param
  through the onboarding flow (fix #6)
- Treat empty username in settings as a validation error instead of a
  silent no-op (fix #7)
- Use exact/sub-path matching in isOnboardingExempt to prevent
  false-positive prefix matches like /loginpage (fix #8)

https://claude.ai/code/session_01UinBMAy9d6dQzzbcUAdq8J

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-15 11:17:15 -07:00
..
admin.simulators.test.ts Hide completed seasons in admin tools (#418) 2026-05-12 16:52:26 -07:00
admin.sports-seasons.$id.test.ts Improve unmatched team reconciliation UX (#425) 2026-05-14 16:45:02 -07:00
admin.sports-seasons.helpers.test.ts Hide completed seasons in admin tools (#418) 2026-05-12 16:52:26 -07:00
admin.sports.$id.test.ts Formalize simulator system with manifest, input-policy, runner, and admin UI (#409) 2026-05-11 21:09:53 -07:00
admin.sports.new.test.ts Formalize simulator system with manifest, input-policy, runner, and admin UI (#409) 2026-05-11 21:09:53 -07:00
admin.tournaments.$id.test.tsx Canonical tournament layer: 2026-05-01 21:04:48 -07:00
api.upload-sport-icon.test.ts Add Cloudinary sports icon uploads (#393) 2026-05-07 16:07:34 -07:00
api.webhooks.cloudinary.test.ts Add Cloudinary-backed avatar system (#385) 2026-05-06 14:47:37 -07:00
batch-results-helpers.test.ts feat: batch qualifying results entry (#290) 2026-04-12 14:52:22 -07:00
check-email.test.ts Add email verification for email/password signups (#400) 2026-05-09 23:58:45 -07:00
onboarding.test.ts Add user onboarding flow with username selection (#430) 2026-05-15 11:17:15 -07:00
root.onboarding-exempt.test.ts Add user onboarding flow with username selection (#430) 2026-05-15 11:17:15 -07:00