migration

This commit is contained in:
Daniel Arantes Loverde
2026-08-11 13:22:02 -03:00
parent c4d6998595
commit 7702836fe7
231 changed files with 4329 additions and 1958 deletions

View File

@@ -0,0 +1,32 @@
import SwiftUI
import Testing
@testable import PediFoods
@MainActor
private func makeCheckoutView() -> CheckoutView {
var appState = AppState()
let appStateBinding = Binding(get: { appState }, set: { appState = $0 })
var selectedTab = MainTab.cart
let tabBinding = Binding(get: { selectedTab }, set: { selectedTab = $0 })
return CheckoutView(appState: appStateBinding, selectedTab: tabBinding)
}
@Test("formatCurrency formats a Double as Brazilian Real with a comma decimal separator")
@MainActor
func formatCurrencyUsesCommaDecimalSeparator() {
let view = makeCheckoutView()
#expect(view.formatCurrency(29.9) == "R$ 29,90")
#expect(view.formatCurrency(0) == "R$ 0,00")
#expect(view.formatCurrency(1234.5) == "R$ 1234,50")
}
@Test("CheckoutPayloadValidationError provides a distinct Portuguese message per case")
func checkoutPayloadValidationErrorMessages() {
#expect(CheckoutView.CheckoutPayloadValidationError.emptyCart.errorDescription == "Carrinho vazio.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingCustomerName.errorDescription == "Nome do cliente não informado.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingCustomerEmail.errorDescription == "Email do cliente não informado.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingCustomerPhone.errorDescription == "Telefone do cliente não informado.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingAddressStreet.errorDescription == "Rua do endereço não informada.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingAddressNumber.errorDescription == "Número do endereço não informado.")
#expect(CheckoutView.CheckoutPayloadValidationError.missingAddressNeighborhood.errorDescription == "Bairro do endereço não informado.")
}