fix: correct Encarnación spelling and accent-insensitive address matching (4.x) - #709
fix: correct Encarnación spelling and accent-insensitive address matching (4.x)#709kaio-donadelli wants to merge 5 commits into
Conversation
LOC-28704 — cocacolapy requested the accented city name in Itapúa. Co-authored-by: Cursor <cursoragent@cursor.com>
Backport 33 geolocation example keys from main so lint:locales passes. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
🛡️ SDD Check — action requiredI couldn't detect an SDD in this PR. Please check one option below (requires write access to the repo):
|
fdaciuk
left a comment
There was a problem hiding this comment.
Um achado bloqueante: o rename quebra a validação de endereços já salvos com a grafia antiga.
Use accent-insensitive matching for saved addresses, fix SLV example, and add regression test. Co-authored-by: Cursor <cursoragent@cursor.com>
fdaciuk
left a comment
There was a problem hiding this comment.
Dois cenários deixam o campo de CEP em branco mesmo com o endereço validado (Paraguai e países de 3 níveis), e a correção do exemplo do SLV não chega ao usuário final.
Normalize nested optionsMap keys, resolve SelectPostalCode values, align validateAddress with main, and fix SLV geolocation example in en.json. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace Ljubljana placeholder with San Salvador address, keeping each locale prefix. Co-authored-by: Cursor <cursoragent@cursor.com>
fdaciuk
left a comment
There was a problem hiding this comment.
Assunto anterior todo resolvido. Ficaram 4 pontos novos no diff deste round, um deles é só uma pergunta.
| } | ||
|
|
||
| function getOptionValueNormalizer(fieldName, address) { | ||
| if (address[fieldName]?.geolocationAutoCompleted) { |
There was a problem hiding this comment.
Isso é intencional? Para campos vindos de geolocalização, a comparação continua exigindo acento certo (normalizeOptionValueStrict), então o mesmo problema de acento que este PR resolve para endereços salvos manualmente pode persistir aqui. Combinado com omitAutoCompletedFields, o campo inválido fica oculto do formulário sem o usuário conseguir corrigir. Se for proposital (fix restrito a endereços salvos), pode ignorar.
| expect(validCityOption.valid).toBe(true) | ||
| }) | ||
|
|
||
| it('should validate if a field option matches even if accents differ', () => { |
There was a problem hiding this comment.
Nenhum teste cobre o caminho estrito de geolocationAutoCompleted (linha 159 de validateAddress.js). Todos os testes de acento aqui usam endereços sem essa flag — se a condição for invertida por engano, a suíte continua passando. Vale um teste cobrindo esse caminho.
| 'Encarnacion', | ||
| 'city', | ||
| validAddress, | ||
| accentInsensitiveValidationRules |
There was a problem hiding this comment.
Esse teste validava o arquivo real react/country/PRY.js (via pryRules) — o arquivo cujo erro de grafia este PR corrige. Trocado por accentInsensitiveValidationRules, um mock próprio, nenhum teste no repositório lê mais o PRY.js real. Se o acento for perdido de novo lá, nenhum teste avisa.
| option.postalCode === postalCodeValue | ||
| ) | ||
|
|
||
| return matchingOption ? matchingOption.label : fieldValue |
There was a problem hiding this comment.
getResolvedPostalCodeFieldLabel tem três caminhos e só o caminho feliz é testado. Faltam casos para: sem CEP salvo (deveria retornar null, linha 70) e quando o CEP salvo não bate com nenhuma opção — aqui a função devolve o valor bruto e o select volta a ficar em branco, reproduzindo em silêncio o bug que este PR corrige.
What is the purpose of this pull request?
Backport Paraguay Encarnación spelling fix to
4.x, including saved-address compatibility and postal code selector fixes.Summary
Encarnacion→Encarnacióninreact/country/PRY.jsvalidateAddress.jswith main (accent-insensitive matching, geolocation-aware normalizers)optionsMapand postal code lookups withcleanStrSelectPostalCodeblank value for saved addresses with legacy spellingmessages/en.json(was Ljubljana)messages/context.jsonfrommainTests
validateAddress,fields,postalCode, andSelectPostalCoderegression tests withcountry/__mocks__fixturesTracked in LOC-28704