Files
honeyDueKMP/composeApp/src/androidInstrumentedTest/kotlin/com/tt/honeyDue/fixtures/TestResidence.kt
Trey T 2d80ade6bc Test infra: shared accessibility IDs + PageObjects + AAA_SeedTests
Ports iOS HoneyDueUITests AccessibilityIdentifiers + PageObjects pattern
to Android Compose UI Test. Kotlin AccessibilityIds object mirrors Swift
verbatim so scripts/verify_test_tag_parity.sh can gate on divergence.

AAA_SeedTests bracketed first alphanumerically; SuiteZZ cleanup to follow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 14:19:37 -05:00

61 lines
1.8 KiB
Kotlin

package com.tt.honeyDue.fixtures
import com.tt.honeyDue.models.ResidenceCreateRequest
import kotlin.random.Random
/**
* Test residence fixture mirroring `TestFixtures.TestResidence` in Swift.
* Produces the exact payload shape the Go API expects so seed tests can
* call `APILayer.createResidence(fixture.toCreateRequest())`.
*/
data class TestResidence(
val name: String,
val streetAddress: String,
val city: String,
val stateProvince: String,
val postalCode: String,
val country: String = "USA",
val bedrooms: Int? = null,
val bathrooms: Double? = null,
val isPrimary: Boolean = false,
) {
fun toCreateRequest(): ResidenceCreateRequest = ResidenceCreateRequest(
name = name,
streetAddress = streetAddress,
city = city,
stateProvince = stateProvince,
postalCode = postalCode,
country = country,
bedrooms = bedrooms,
bathrooms = bathrooms,
isPrimary = isPrimary,
)
companion object {
fun house(suffix: String = randomSuffix()): TestResidence = TestResidence(
name = "Test House $suffix",
streetAddress = "123 Test St",
city = "Testville",
stateProvince = "CA",
postalCode = "94000",
bedrooms = 3,
bathrooms = 2.0,
isPrimary = true,
)
fun apartment(suffix: String = randomSuffix()): TestResidence = TestResidence(
name = "Test Apt $suffix",
streetAddress = "456 Mock Ave",
city = "Testville",
stateProvince = "CA",
postalCode = "94001",
bedrooms = 1,
bathrooms = 1.0,
isPrimary = false,
)
private fun randomSuffix(): String =
Random.nextInt(1000, 9999).toString()
}
}