📋 Description
The preferences write path validates input with utils/validation/preferences-validation.ts (validateCurrency, validateLanguage, validateNotificationsEnabled, validateTimezone, validatePreferencesUpdate) against the allow-lists in utils/constants/supported-values.ts (SUPPORTED_CURRENCIES, SUPPORTED_LANGUAGES, COMMON_TIMEZONES, DEFAULT_PREFERENCES). This is used by app/api/user/preferences/route.ts (PATCH). There is no test file for either.
Why this matters: preferences validation is the guard that keeps an unsupported currency or bogus locale out of the database and out of the currency formatter / i18n layer. A gap here surfaces later as broken formatting or a missing translation. Validation against a fixed allow-list is trivially testable and worth locking down.
🎯 Requirements & Context
Functional requirements
Context & constraints
- Vitest
4.0.18; pure-function tests, no I/O.
- Test-only unless a real validation gap is found (document it in the PR).
🛠️ Suggested Execution
1. Fork & branch
git checkout -b test/preferences-validation
2. Implement changes
- Add table-driven tests iterating the allow-lists; add a consistency check for defaults.
3. Test & commit
npm run test:coverage
npx tsc --noEmit
- Cover edge cases: empty string, wrong case (e.g.
"usd" vs "USD"), null, numeric language, unknown timezone.
Example commit message
test(preferences): add coverage for preferences validation + supported values
Proves allow-list acceptance/rejection and DEFAULT_PREFERENCES consistency.
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| All validators covered |
Required |
| Defaults-consistency assertion |
Required |
| Coverage of preferences validation |
≥ 95% lines |
npx tsc --noEmit, npm run lint clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Please comment when you pick this up so we can avoid duplicate work. 🚀
📋 Description
The preferences write path validates input with
utils/validation/preferences-validation.ts(validateCurrency,validateLanguage,validateNotificationsEnabled,validateTimezone,validatePreferencesUpdate) against the allow-lists inutils/constants/supported-values.ts(SUPPORTED_CURRENCIES,SUPPORTED_LANGUAGES,COMMON_TIMEZONES,DEFAULT_PREFERENCES). This is used byapp/api/user/preferences/route.ts(PATCH). There is no test file for either.🎯 Requirements & Context
Functional requirements
tests/unit/preferences-validation.test.ts(Vitest).ValidationError).validatePreferencesUpdateaccepts a partial update, ignores undefined fields, and rejects when any provided field is invalid.DEFAULT_PREFERENCESis internally consistent (its currency/language are members of the supported lists).notifications_enabledrejects non-boolean inputs.Context & constraints
4.0.18; pure-function tests, no I/O.🛠️ Suggested Execution
1. Fork & branch
2. Implement changes
3. Test & commit
"usd"vs"USD"), null, numeric language, unknown timezone.Example commit message
✅ Acceptance Criteria & Guidelines
npx tsc --noEmit,npm run lintclean💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Please comment when you pick this up so we can avoid duplicate work. 🚀