chore: initial setup, orderForm query, mutations and utility unit testing#215
Merged
Conversation
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
|
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.
|
b13c05c to
412fc45
Compare
c09c8b1 to
a89ff60
Compare
fdaciuk
requested changes
May 29, 2026
df1da5e to
fc7bd9a
Compare
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.
What problem is this solving?
Além disso, também adiciona testes novos cobrindo o módulo crítico de validação e funções de utils:
validation.test.ts
isPaymentValid(2 testes): array vazio vs. com payment.isProfileValid(8 testes): profile null, cada um dos 5 campos obrigatórios faltando (via it.each), short-circuit comcanEditData=false, phone sem country code, phone com country code mas pattern falhando, caminho feliz.isShippingValid(10 testes): sem selectedAddress, sem opção selecionada, pickup aceito, short-circuit canEditData=false + não-disposable, fallback de validação quando disposable, country vazio, countrySettings null, campo required ausente, campo excedendo maxLength, caminho feliz.messages.test.ts — 5 testes
couponExpired/couponNotFoundcomo coupon, descarte decannotBeDelivered, fallback parageneralMessages, ordem preservada em input misto.pickup.test.ts — 6 testes
Lista vazia → 3 entradas fechadas; reordenação dos dias para [1,2,3,4,5,6,0]; condensação
1to5quando Seg-Qui batem; ausência de condensação quando Seg-Qui diferem; dias ausentes marcados comoclosed:true; bug locking: quirk de Seg-Qui igual + Sex diferente que perde as horas de Sexta (documentado no teste).subscriptions.test.ts — 13 testes
parseFrequency: 5 inputs válidos viait.each(weekly,monthly,30 days,2 months,1 year), trim, uppercase, string vazia, só whitespace, só dígitos.generateSubscriptionDataEntry: input vazio, opção sem chave de subscription, opção com frequência inválida, shape completo do entry, filtragem mantendo apenas válidos preservando itemIndex, primeiro option vence quando há múltiplos.image.test.ts — 9 testes
vtex: URL com tamanho pré-existente (strip + regenera), URL sem tamanho (apenas adiciona), conversão http:// → //, URL fora do padrão ids// → undefined.gocommerce: drop de querystring + sizing via ?width=…, https:// → //.Fallback de plataforma desconhecida → passthrough.
Falsy inputs:
undefinede string vazia →undefined.delivery-options.test.ts — 9 testes
getFormattedDeliveryOptions(6): lista vazia, logisticsInfo=null → preço 0/isSelected=false, soma de preço entre múltiplos logisticsInfo, isSelected=true quando qualquer selectedSla bate, isSelected=false quando nenhum bate, pickupPointId apenas em SLAs pickup-in-point.hasDeliveryOption(3): id presente → true, id ausente → false, lista vazia → false.address.test.ts — 13 testes
getSelectedAddress(5): lista vazia, skip pickup, skip inStore, ambos pickup+inStore → undefined, retorna o primeiro válido.addressHasGeocoordinates(3): [] → falsy, populado → truthy, address undefined → falsy.filterDeliveryOptions(5): lista vazia, exclusão de SLA agendada (availableDeliveryWindows > 0), exclusão por deliveryChannel inválido, exclusão de SLA não presente em todos os logisticsInfo, mantém pickup-in-point quando válido.shipping-utils.test.ts — 15 testes
getShippingData(4): logisticsInfo=null → [], propagação de addressId, ausência da flag sem geo coords, flag presente com geo coords.selectShippingOption(5): shippingData=null → null, sem endereço válido → passthrough, selectedDeliveryChannel em todos os logisticsInfo, marcação em todos quando sem itemId, marcação só no itemId correspondente quando especificado.selectAddress(3): shippingData=null → null, substitui selectedAddresses, preserva o restante.getShippingInfoauto-correção de totalizer (3): caso desbalanceado → chama updateOrderFormShipping + muta value + atualiza totalizer.value; caso balanceado → nenhum side-effect; sem totalizer "Shipping" → nenhum side-effect.orderForm-root.test.ts — 38 testes
OrderForm.id(1): mapeiaorderFormId.OrderForm.marketingData/storePreferencesData(3): default {} e passthrough.OrderForm.allowManualPrice(5): não call-center → false; admin permite → true; orderForm permite → true; nenhum permite → false; admin retorna null → fallback no orderForm.OrderForm.userType(3): call-center →'CALL_CENTER_OPERATOR'; comum →'STORE_USER'; semvtex_session→ loga warn e retorna'STORE_USER'.OrderForm.messages(2): particiona e chama clearMessages; lista vazia não chama.OrderForm.clientProfileData(3): null quando ausente; isValid: true (canEditData=false short-circuit); isValid: false quando faltam campos.OrderForm.shipping(2): empty → isValid: false; com endereço + SLA + countrySettings válido → isValid: true.OrderForm.paymentData(2): payments vazio → isValid: false; com payment → isValid: true.ClientPreferencesData.optInNewsletter(2): mapeia optinNewsLetter → optInNewsletter; ausente → undefined.MarketingData.*(15): cada um dos 6 campos retorna o valor; cada um dos 7 campos retorna '' quando ausente; utmiPage lê de utmipage lowercase (regressão antiga preservada); confirma que utmiPage camelCase NÃO é lido.How should this be manually tested?
Checklist/Reminders
README.md.CHANGELOG.md.Type of changes
Notes