feat: i18n browser language detection + extract deposit validators with Vitest#36
Open
zqleslie wants to merge 1 commit into
Open
feat: i18n browser language detection + extract deposit validators with Vitest#36zqleslie wants to merge 1 commit into
zqleslie wants to merge 1 commit into
Conversation
…t tests (Wave 5 davz7#27 davz7#29) Issue davz7#29: - Detect navigator.language on first visit (en→'en', else→'es') - Persist user language choice in localStorage('ms-lang') - Update LandingNavbar toggle to write to localStorage - i18n fallbackLng stays 'es' Issue davz7#27: - Extract validators into netlify/functions/_lib/depositValidation.js - Add Vitest test file with full coverage - Update etherfuse-deposit.js to import from helper - Add vitest to devDependencies + test:functions script Fixes: davz7#27, davz7#29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses issue #27 and issue #29 for Stellar Wave 5.
Issue #29 — Auto-detect browser language and persist preference ✅
localStorage.getItem('ms-lang')firstnavigator.language— if it starts withen, usesen; otherwise defaults toesLandingNavbar.jsx, the new value is written tolocalStorage.setItem('ms-lang', lang)fallbackLngstays asesi18next(lighter than addingi18next-browser-languagedetector)Issue #27 — Vitest unit tests for deposit validation helpers ✅
netlify/functions/_lib/depositValidation.js:validateAmount— min/max range validation ($40–$100,000 MXN)validateKyc— KYC status check (must be 'approved')validateBankAccount— bank account status check (must be 'active')validateUserId— user ID presence checknetlify/functions/_lib/depositValidation.test.jswith full coverage:etherfuse-deposit.jsto import from the helper — no behavior changevitesttodevDependenciesandnpm run test:functionsscriptFiles changed
CreditRoot/src/i18n/index.js— Added browser language detection + localStorage persistenceCreditRoot/src/screens/components/LandingNavbar.jsx— Added localStorage write on togglenetlify/functions/_lib/depositValidation.js(new) — Extracted pure validation helpersnetlify/functions/_lib/depositValidation.test.js(new) — Vitest unit testsnetlify/functions/etherfuse-deposit.js— Refactored to use extracted validatorspackage.json— Added vitest + test scriptvitest.config.js(new) — Vitest configurationPart of Stellar Wave 5 — May 26 to Jun 2, 2026