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,47 @@
import Foundation
import Testing
@testable import PediFoods
/// `GuestLocationStore.shared` is a singleton backed by the real Keychain
/// under fixed key names - concurrent tests touching the same keys would
/// stomp on each other, so this suite runs serialized. Every test cleans
/// up after itself via the store's own clear/nil-set APIs.
@Suite(.serialized)
struct GuestLocationStoreTests {
@Test("deviceId is stable across repeated reads")
func deviceIdIsStableAcrossReads() {
let first = GuestLocationStore.shared.deviceId
let second = GuestLocationStore.shared.deviceId
#expect(first == second)
#expect(first.isEmpty == false)
}
@Test("selectedState/selectedCity round-trip and clear together via clearSelectedLocation")
func selectedStateAndCityRoundTripAndClear() {
GuestLocationStore.shared.selectedState = "SP"
GuestLocationStore.shared.selectedCity = "São Paulo"
#expect(GuestLocationStore.shared.selectedState == "SP")
#expect(GuestLocationStore.shared.selectedCity == "São Paulo")
GuestLocationStore.shared.clearSelectedLocation()
#expect(GuestLocationStore.shared.selectedState == nil)
#expect(GuestLocationStore.shared.selectedCity == nil)
}
@Test("appAttestKeyId round-trips and clears when set to nil")
func appAttestKeyIdRoundTripAndClear() {
GuestLocationStore.shared.appAttestKeyId = "key-123"
#expect(GuestLocationStore.shared.appAttestKeyId == "key-123")
GuestLocationStore.shared.appAttestKeyId = nil
#expect(GuestLocationStore.shared.appAttestKeyId == nil)
}
@Test("attestationPlaceholder is stable across repeated reads")
func attestationPlaceholderIsStableAcrossReads() {
let first = GuestLocationStore.shared.attestationPlaceholder
let second = GuestLocationStore.shared.attestationPlaceholder
#expect(first == second)
#expect(first.isEmpty == false)
}
}