diff --git a/test_runner/src/main/kotlin/ftl/adapter/GoogleDeviceModel.kt b/test_runner/src/main/kotlin/ftl/adapter/GoogleDeviceModel.kt index eb4315fcb7..87bdab3e49 100644 --- a/test_runner/src/main/kotlin/ftl/adapter/GoogleDeviceModel.kt +++ b/test_runner/src/main/kotlin/ftl/adapter/GoogleDeviceModel.kt @@ -4,7 +4,7 @@ import ftl.adapter.google.toAndroidApiModel import ftl.adapter.google.toIosApiModel import ftl.api.DeviceModel import ftl.client.google.AndroidCatalog -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog object GoogleAndroidDeviceModel : DeviceModel.Android.Fetch, diff --git a/test_runner/src/main/kotlin/ftl/adapter/GoogleLocalesFetch.kt b/test_runner/src/main/kotlin/ftl/adapter/GoogleLocalesFetch.kt new file mode 100644 index 0000000000..cc6cf99972 --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/adapter/GoogleLocalesFetch.kt @@ -0,0 +1,16 @@ +package ftl.adapter + +import ftl.adapter.google.toApiModel +import ftl.api.Locale +import ftl.api.Platform +import ftl.client.google.AndroidCatalog +import ftl.client.google.IosCatalog + +object GoogleLocalesFetch : + Locale.Fetch, + (Locale.Identity) -> List by { id -> + when (id.platform) { + Platform.ANDROID -> AndroidCatalog.getLocales(id.projectId).toApiModel() + Platform.IOS -> IosCatalog.getLocales(id.projectId).toApiModel() + } + } diff --git a/test_runner/src/main/kotlin/ftl/adapter/GoogleOrientationFetch.kt b/test_runner/src/main/kotlin/ftl/adapter/GoogleOrientationFetch.kt index 52193c23d8..92a477eba7 100644 --- a/test_runner/src/main/kotlin/ftl/adapter/GoogleOrientationFetch.kt +++ b/test_runner/src/main/kotlin/ftl/adapter/GoogleOrientationFetch.kt @@ -4,7 +4,7 @@ import ftl.adapter.google.toApiModel import ftl.api.Orientation import ftl.api.Platform import ftl.client.google.AndroidCatalog -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog object GoogleOrientationFetch : Orientation.Fetch, diff --git a/test_runner/src/main/kotlin/ftl/adapter/google/LocalesAdapter.kt b/test_runner/src/main/kotlin/ftl/adapter/google/LocalesAdapter.kt new file mode 100644 index 0000000000..52c89b6403 --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/adapter/google/LocalesAdapter.kt @@ -0,0 +1,13 @@ +package ftl.adapter.google + +import ftl.api.Locale +import com.google.testing.model.Locale as GoogleApiLocale + +internal fun List.toApiModel(): List = map { locale -> + Locale( + id = locale.id.orEmpty(), + name = locale.name.orEmpty(), + region = locale.region.orEmpty(), + tags = locale.tags.orEmpty() + ) +} diff --git a/test_runner/src/main/kotlin/ftl/api/Locale.kt b/test_runner/src/main/kotlin/ftl/api/Locale.kt new file mode 100644 index 0000000000..a82aaf49f2 --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/api/Locale.kt @@ -0,0 +1,20 @@ +package ftl.api + +import ftl.adapter.GoogleLocalesFetch + +val fetchLocales: Locale.Fetch get() = GoogleLocalesFetch + +data class Locale( + val id: String, + val name: String, + val region: String, + val tags: List, +) { + + data class Identity( + val projectId: String, + val platform: Platform + ) + + interface Fetch : (Identity) -> List +} diff --git a/test_runner/src/main/kotlin/ftl/api/Orientation.kt b/test_runner/src/main/kotlin/ftl/api/Orientation.kt index 27725ffb0f..cd084b160f 100644 --- a/test_runner/src/main/kotlin/ftl/api/Orientation.kt +++ b/test_runner/src/main/kotlin/ftl/api/Orientation.kt @@ -11,8 +11,3 @@ data class Orientation( ) { interface Fetch : (String, Platform) -> List } - -enum class Platform { - ANDROID, - IOS -} diff --git a/test_runner/src/main/kotlin/ftl/api/Platform.kt b/test_runner/src/main/kotlin/ftl/api/Platform.kt new file mode 100644 index 0000000000..618546fda5 --- /dev/null +++ b/test_runner/src/main/kotlin/ftl/api/Platform.kt @@ -0,0 +1,6 @@ +package ftl.api + +enum class Platform { + ANDROID, + IOS +} diff --git a/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt b/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt index 94758da14c..3568ef4b86 100644 --- a/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt +++ b/test_runner/src/main/kotlin/ftl/args/ValidateIosArgs.kt @@ -4,8 +4,8 @@ import com.google.common.annotations.VisibleForTesting import flank.common.logLn import ftl.api.fetchDeviceModelIos import ftl.args.yml.Type -import ftl.ios.IosCatalog -import ftl.ios.IosCatalog.getSupportedVersionId +import ftl.client.google.IosCatalog +import ftl.client.google.IosCatalog.getSupportedVersionId import ftl.ios.xctest.XcTestRunData import ftl.ios.xctest.common.XcTestRunVersion import ftl.ios.xctest.common.mapToRegex diff --git a/test_runner/src/main/kotlin/ftl/client/google/AndroidCatalog.kt b/test_runner/src/main/kotlin/ftl/client/google/AndroidCatalog.kt index d4b84f82e2..e205612543 100644 --- a/test_runner/src/main/kotlin/ftl/client/google/AndroidCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/client/google/AndroidCatalog.kt @@ -8,7 +8,6 @@ import flank.common.logLn import ftl.api.fetchAndroidOsVersion import ftl.environment.android.getDescription import ftl.environment.android.toCliTable -import ftl.environment.asPrintableTable import ftl.environment.getLocaleDescription import ftl.gc.GcTesting import ftl.http.executeWithRetry @@ -40,11 +39,9 @@ object AndroidCatalog { fun supportedOrientations(projectId: String): List = deviceCatalog(projectId).runtimeConfiguration.orientations - fun localesAsTable(projectId: String) = getLocales(projectId).asPrintableTable() + private fun getLocaleDescription(projectId: String, locale: String) = getLocales(projectId).getLocaleDescription(locale) - fun getLocaleDescription(projectId: String, locale: String) = getLocales(projectId).getLocaleDescription(locale) - - private fun getLocales(projectId: String) = deviceCatalog(projectId).runtimeConfiguration.locales + internal fun getLocales(projectId: String) = deviceCatalog(projectId).runtimeConfiguration.locales fun androidModelIds(projectId: String) = modelMap.getOrPut(projectId) { deviceCatalog(projectId).models.map { it.id } } diff --git a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt b/test_runner/src/main/kotlin/ftl/client/google/IosCatalog.kt similarity index 86% rename from test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt rename to test_runner/src/main/kotlin/ftl/client/google/IosCatalog.kt index d329f602c0..a7cb741a52 100644 --- a/test_runner/src/main/kotlin/ftl/ios/IosCatalog.kt +++ b/test_runner/src/main/kotlin/ftl/client/google/IosCatalog.kt @@ -1,10 +1,9 @@ -package ftl.ios +package ftl.client.google import com.google.testing.model.IosDeviceCatalog import com.google.testing.model.IosModel import com.google.testing.model.Orientation import ftl.config.Device -import ftl.environment.asPrintableTable import ftl.environment.getLocaleDescription import ftl.environment.ios.getDescription import ftl.environment.ios.toCliTable @@ -29,11 +28,9 @@ object IosCatalog { private fun getVersionsList(projectId: String) = iosDeviceCatalog(projectId).versions - fun localesAsTable(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.locales.asPrintableTable() + private fun getLocaleDescription(projectId: String, locale: String) = getLocales(projectId).getLocaleDescription(locale) - fun getLocaleDescription(projectId: String, locale: String) = getLocales(projectId).getLocaleDescription(locale) - - private fun getLocales(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.locales + internal fun getLocales(projectId: String) = iosDeviceCatalog(projectId).runtimeConfiguration.locales fun supportedOrientations(projectId: String): List = iosDeviceCatalog(projectId).runtimeConfiguration.orientations diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt index a0917348a2..e575f5b519 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt @@ -1,8 +1,11 @@ package ftl.domain import flank.common.log +import ftl.api.Locale +import ftl.api.Platform +import ftl.api.fetchLocales import ftl.args.AndroidArgs -import ftl.client.google.AndroidCatalog +import ftl.environment.getLocaleDescription import ftl.run.exception.FlankConfigurationError import java.nio.file.Paths @@ -13,5 +16,12 @@ interface DescribeAndroidLocales { fun DescribeAndroidLocales.invoke() { if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.") - log(AndroidCatalog.getLocaleDescription(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, locale)) + log( + fetchLocales( + Locale.Identity( + AndroidArgs.loadOrDefault(Paths.get(configPath)).project, + Platform.ANDROID + ) + ).getLocaleDescription(locale) + ) } diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidTestEnvironment.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidTestEnvironment.kt index e26137120c..0c7cfb77b6 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidTestEnvironment.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeAndroidTestEnvironment.kt @@ -1,15 +1,16 @@ package ftl.domain import flank.common.logLn +import ftl.api.Locale.Identity import ftl.api.Platform import ftl.api.fetchAndroidOsVersion import ftl.api.fetchDeviceModelAndroid import ftl.api.fetchIpBlocks +import ftl.api.fetchLocales import ftl.api.fetchNetworkProfiles import ftl.api.fetchOrientation import ftl.api.fetchSoftwareCatalog import ftl.args.AndroidArgs -import ftl.client.google.AndroidCatalog import ftl.environment.android.toCliTable import ftl.environment.common.toCliTable import ftl.environment.toCliTable @@ -24,7 +25,7 @@ fun DescribeAndroidTestEnvironment.invoke() { // TODO move toCliTable() to presentation layer during refactor of presentation after #1728 logLn(fetchAndroidOsVersion(projectId).toCliTable()) logLn(fetchDeviceModelAndroid(projectId).toCliTable()) // TODO move toCliTable() to presentation layer during refactor of presentation after #1728 - logLn(AndroidCatalog.localesAsTable(projectId)) + logLn(fetchLocales(Identity(projectId, Platform.ANDROID)).toCliTable()) logLn(fetchSoftwareCatalog().toCliTable()) logLn(fetchNetworkProfiles().toCliTable()) logLn(fetchOrientation(projectId, Platform.ANDROID).toCliTable()) // TODO move toCliTable() to presentation layer during refactor of presentation after #1728 diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt index 4f41b44a5b..7ad05b9569 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt @@ -1,8 +1,11 @@ package ftl.domain import flank.common.log +import ftl.api.Locale.Identity +import ftl.api.Platform +import ftl.api.fetchLocales import ftl.args.IosArgs -import ftl.ios.IosCatalog +import ftl.environment.getLocaleDescription import ftl.run.exception.FlankConfigurationError import java.nio.file.Paths @@ -13,5 +16,7 @@ interface DescribeIosLocales { fun DescribeIosLocales.invoke() { if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.") - log(IosCatalog.getLocaleDescription(IosArgs.loadOrDefault(Paths.get(configPath)).project, locale)) + log( + fetchLocales(Identity(IosArgs.loadOrDefault(Paths.get(configPath)).project, Platform.IOS)).getLocaleDescription(locale) + ) } diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeIosModels.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeIosModels.kt index 4ee0b3d2d6..d5492a10de 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeIosModels.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeIosModels.kt @@ -3,7 +3,6 @@ package ftl.domain import flank.common.logLn import ftl.api.fetchDeviceModelIos import ftl.args.IosArgs -import ftl.environment.android.getDescription import ftl.environment.ios.getDescription import ftl.run.exception.FlankConfigurationError import java.nio.file.Paths diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeIosTestEnvironment.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeIosTestEnvironment.kt index 5d2dcfc836..ca10e57819 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeIosTestEnvironment.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeIosTestEnvironment.kt @@ -1,17 +1,19 @@ package ftl.domain import flank.common.logLn +import ftl.api.Locale.Identity import ftl.api.Platform import ftl.api.fetchDeviceModelIos import ftl.api.fetchIpBlocks +import ftl.api.fetchLocales import ftl.api.fetchNetworkProfiles import ftl.api.fetchOrientation import ftl.api.fetchSoftwareCatalog import ftl.args.IosArgs +import ftl.client.google.IosCatalog import ftl.environment.common.toCliTable import ftl.environment.ios.toCliTable import ftl.environment.toCliTable -import ftl.ios.IosCatalog import java.nio.file.Paths interface DescribeIosTestEnvironment { @@ -22,7 +24,7 @@ operator fun DescribeIosTestEnvironment.invoke() { val projectId = IosArgs.loadOrDefault(Paths.get(configPath)).project logLn(fetchDeviceModelIos(projectId).toCliTable()) // TODO move toCliTable() and printing presentation layer during refactor of presentation after #1728 logLn(IosCatalog.softwareVersionsAsTable(projectId)) - logLn(IosCatalog.localesAsTable(projectId)) + logLn(fetchLocales(Identity(projectId, Platform.IOS)).toCliTable()) logLn(fetchSoftwareCatalog().toCliTable()) logLn(fetchNetworkProfiles().toCliTable()) logLn(fetchOrientation(projectId, Platform.IOS).toCliTable()) // TODO move toCliTable() and printing presentation layer during refactor of presentation after #1728 diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeIosVersions.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeIosVersions.kt index 6e79752ce4..5a00e5be1e 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeIosVersions.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeIosVersions.kt @@ -2,7 +2,7 @@ package ftl.domain import flank.common.logLn import ftl.args.IosArgs -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import ftl.run.exception.FlankConfigurationError import java.nio.file.Paths diff --git a/test_runner/src/main/kotlin/ftl/domain/ListAndroidLocales.kt b/test_runner/src/main/kotlin/ftl/domain/ListAndroidLocales.kt index f61ed9fc82..2e8353c8b5 100644 --- a/test_runner/src/main/kotlin/ftl/domain/ListAndroidLocales.kt +++ b/test_runner/src/main/kotlin/ftl/domain/ListAndroidLocales.kt @@ -1,8 +1,11 @@ package ftl.domain import flank.common.logLn +import ftl.api.Locale.Identity +import ftl.api.Platform +import ftl.api.fetchLocales import ftl.args.AndroidArgs -import ftl.client.google.AndroidCatalog +import ftl.environment.toCliTable import java.nio.file.Paths interface ListAndroidLocales { @@ -10,5 +13,7 @@ interface ListAndroidLocales { } operator fun ListAndroidLocales.invoke() { - logLn(AndroidCatalog.localesAsTable(projectId = AndroidArgs.loadOrDefault(Paths.get(configPath)).project)) + logLn( + fetchLocales(Identity(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, Platform.ANDROID)).toCliTable() + ) } diff --git a/test_runner/src/main/kotlin/ftl/domain/ListIosLocales.kt b/test_runner/src/main/kotlin/ftl/domain/ListIosLocales.kt index 516d70b5f2..9050b19717 100644 --- a/test_runner/src/main/kotlin/ftl/domain/ListIosLocales.kt +++ b/test_runner/src/main/kotlin/ftl/domain/ListIosLocales.kt @@ -1,8 +1,11 @@ package ftl.domain import flank.common.logLn +import ftl.api.Locale.Identity +import ftl.api.Platform +import ftl.api.fetchLocales import ftl.args.IosArgs -import ftl.ios.IosCatalog +import ftl.environment.toCliTable import java.nio.file.Paths interface ListIosLocales { @@ -10,5 +13,5 @@ interface ListIosLocales { } operator fun ListIosLocales.invoke() { - logLn(IosCatalog.localesAsTable(projectId = IosArgs.loadOrDefault(Paths.get(configPath)).project)) + logLn(fetchLocales(Identity(IosArgs.loadOrDefault(Paths.get(configPath)).project, Platform.IOS)).toCliTable()) } diff --git a/test_runner/src/main/kotlin/ftl/domain/ListIosVersions.kt b/test_runner/src/main/kotlin/ftl/domain/ListIosVersions.kt index 189ed45cf2..0102adf8f6 100644 --- a/test_runner/src/main/kotlin/ftl/domain/ListIosVersions.kt +++ b/test_runner/src/main/kotlin/ftl/domain/ListIosVersions.kt @@ -2,7 +2,7 @@ package ftl.domain import flank.common.logLn import ftl.args.IosArgs -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import java.nio.file.Paths interface ListIosVersions { diff --git a/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt b/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt index a377b7b0f8..3e146e8702 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt +++ b/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt @@ -1,28 +1,54 @@ package ftl.environment -import com.google.testing.model.Locale +import ftl.api.Locale +import ftl.run.exception.FlankGeneralError import ftl.util.applyColorsUsing import ftl.util.buildTable -fun List.asPrintableTable() = createTestEnvironment().createLocalesTable() +fun List.toCliTable() = createTestEnvironment().createLocalesTable() -private fun List.createTestEnvironment() = +fun List.createTestEnvironment() = fold(mutableMapOf>()) { allLocales, locale -> allLocales.apply { getOrCreateList(LOCALE).add(locale.id.orEmpty()) getOrCreateList(NAME).add(locale.name.orEmpty()) getOrCreateList(REGION).add(locale.region.orEmpty()) - getOrCreateList(TAGS).add(locale.tags?.joinToString().orEmpty()) + getOrCreateList(TAGS).add(locale.tags.joinToString().orEmpty()) } } -private fun TestEnvironmentInfo.createLocalesTable() = buildTable( +fun TestEnvironmentInfo.createLocalesTable() = buildTable( createTableColumnFor(LOCALE), createTableColumnFor(NAME), createTableColumnFor(REGION), - createTableColumnFor(TAGS).applyColorsUsing(tagToSystemOutColorMapper) + createTableColumnFor(ftl.environment.TAGS).applyColorsUsing(tagToSystemOutColorMapper) ) private const val LOCALE = "LOCALE" private const val NAME = "NAME" private const val REGION = "REGION" + +fun List.getLocaleDescription(localeId: String) = + findLocales(localeId)?.prepareDescription().orErrorMessage(localeId).plus("\n") + +private fun List.findLocales(localeId: String) = find { it.id == localeId } + +private fun Locale.prepareDescription() = """ + id: $id + name: $name +""".trimIndent().addRegionIfExist(region).addTagsIfExists(this) + +private fun String.addRegionIfExist(region: String?) = + if (!region.isNullOrEmpty()) StringBuilder(this).appendLine("\nregion: $region").trim().toString() + else this + +private fun String.addTagsIfExists(locale: Locale) = + if (!locale.tags.isNullOrEmpty()) StringBuilder(this).appendLine("\ntags:").appendTagsToList(locale) + else this + +private fun StringBuilder.appendTagsToList(locale: Locale) = apply { + locale.tags.filterNotNull().forEach { tag -> appendLine("- $tag") } +}.trim().toString() + +private fun String?.orErrorMessage(locale: String) = + this ?: throw FlankGeneralError("ERROR: '$locale' is not a valid locale") diff --git a/test_runner/src/test/kotlin/ftl/android/AndroidCatalogTest.kt b/test_runner/src/test/kotlin/ftl/android/AndroidCatalogTest.kt index 08e47f5859..3b43448a86 100644 --- a/test_runner/src/test/kotlin/ftl/android/AndroidCatalogTest.kt +++ b/test_runner/src/test/kotlin/ftl/android/AndroidCatalogTest.kt @@ -2,10 +2,14 @@ package ftl.android import com.google.common.truth.Truth.assertThat import com.google.testing.model.AndroidDevice +import ftl.api.Locale +import ftl.api.Platform import ftl.api.fetchAndroidOsVersion import ftl.api.fetchDeviceModelAndroid +import ftl.api.fetchLocales import ftl.client.google.AndroidCatalog import ftl.environment.android.toCliTable +import ftl.environment.toCliTable import ftl.test.util.FlankTestRunner import io.mockk.every import io.mockk.mockk @@ -110,7 +114,7 @@ class AndroidCatalogTest { val expectedSeparatorCount = expectedHeaders.size + 1 // when - val devicesTable = AndroidCatalog.localesAsTable(projectId) + val devicesTable = fetchLocales(Locale.Identity(projectId, Platform.ANDROID)).toCliTable() val headers = devicesTable.lines()[1] // then diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesDescribeCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesDescribeCommandTest.kt index f3b87caff8..d982ea55b6 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesDescribeCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesDescribeCommandTest.kt @@ -20,7 +20,7 @@ class AndroidLocalesDescribeCommandTest { fun `should execute AndroidCatalog getLocaleDescription when run AndroidLocalesDescribeCommand`() { mockkObject(AndroidCatalog) { CommandLine(AndroidLocalesDescribeCommand()).execute("pl") - verify { AndroidCatalog.getLocaleDescription(any(), any()) } + verify { AndroidCatalog.getLocales(any()) } } } diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesListCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesListCommandTest.kt index 87a223c37a..37b7632061 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesListCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/locales/AndroidLocalesListCommandTest.kt @@ -14,7 +14,7 @@ class AndroidLocalesListCommandTest { fun `should execute AndroidCatalog localesAsTable when run AndroidLocalesListCommand`() { mockkObject(AndroidCatalog) { CommandLine(AndroidLocalesListCommand()).execute() - verify { AndroidCatalog.localesAsTable(any()) } + verify { AndroidCatalog.getLocales(any()) } } } diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesDescribeCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesDescribeCommandTest.kt index 45af5284e2..1a2d595a77 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesDescribeCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesDescribeCommandTest.kt @@ -1,6 +1,6 @@ package ftl.cli.firebase.test.ios.configuration -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import ftl.presentation.cli.firebase.test.ios.configuration.IosLocalesDescribeCommand import ftl.run.exception.FlankConfigurationError import ftl.test.util.TestHelper @@ -23,7 +23,7 @@ class IosLocalesDescribeCommandTest { fun `should execute IosCatalog getLocaleDescription when run IosLocalesDescribeCommand`() { mockkObject(IosCatalog) { CommandLine(IosLocalesDescribeCommand()).execute("pl", "--config=$simpleFlankPath") - verify { IosCatalog.getLocaleDescription(any(), any()) } + verify { IosCatalog.getLocales(any()) } } } diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesListCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesListCommandTest.kt index f6b0a7b21e..54680221d4 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesListCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/configuration/IosLocalesListCommandTest.kt @@ -1,7 +1,7 @@ package ftl.cli.firebase.test.ios.configuration import com.google.common.truth.Truth -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import ftl.presentation.cli.firebase.test.ios.configuration.IosLocalesListCommand import io.mockk.mockkObject import io.mockk.verify @@ -14,7 +14,7 @@ class IosLocalesListCommandTest { fun `should execute IosCatalog localesAsTable when run IosLocalesListCommand`() { mockkObject(IosCatalog) { CommandLine(IosLocalesListCommand()).execute() - verify { IosCatalog.localesAsTable(any()) } + verify { IosCatalog.getLocales(any()) } } } diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt index 3c5d8bc311..5ffa4b6610 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/orientations/IosOrientationCommandListTest.kt @@ -1,6 +1,6 @@ package ftl.cli.firebase.test.ios.orientations -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import ftl.presentation.cli.firebase.test.ios.orientations.IosOrientationsListCommand import io.mockk.mockkObject import io.mockk.verify diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/versions/IosVersionsDescribeCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/versions/IosVersionsDescribeCommandTest.kt index abd74f8e77..eb5b6570c5 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/versions/IosVersionsDescribeCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/versions/IosVersionsDescribeCommandTest.kt @@ -1,6 +1,6 @@ package ftl.cli.firebase.test.ios.versions -import ftl.ios.IosCatalog +import ftl.client.google.IosCatalog import ftl.presentation.cli.firebase.test.ios.versions.IosVersionsDescribeCommand import ftl.run.exception.FlankConfigurationError import ftl.test.util.TestHelper.getThrowable diff --git a/test_runner/src/test/kotlin/ftl/ios/IosCatalogTest.kt b/test_runner/src/test/kotlin/ftl/ios/IosCatalogTest.kt index 00f872ffc1..38cf899d43 100644 --- a/test_runner/src/test/kotlin/ftl/ios/IosCatalogTest.kt +++ b/test_runner/src/test/kotlin/ftl/ios/IosCatalogTest.kt @@ -1,6 +1,11 @@ package ftl.ios import com.google.common.truth.Truth.assertThat +import ftl.api.Locale.Identity +import ftl.api.Platform +import ftl.api.fetchLocales +import ftl.client.google.IosCatalog +import ftl.environment.toCliTable import ftl.test.util.FlankTestRunner import org.junit.Test import org.junit.runner.RunWith @@ -43,7 +48,7 @@ class IosCatalogTest { val expectedSeparatorCount = expectedHeaders.size + 1 // when - val devicesTable = IosCatalog.localesAsTable(projectId) + val devicesTable = fetchLocales(Identity(projectId, Platform.IOS)).toCliTable() val headers = devicesTable.lines()[1] // then