Skip to content

Commit

Permalink
chore: Fail tests when API key is missing (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSteve595 authored Jan 19, 2023
1 parent 1892c35 commit 12251ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class GoogleMapViewTests {
private lateinit var cameraPositionState: CameraPositionState

private fun initMap(content: @Composable () -> Unit = {}) {
check(hasValidApiKey) { "Maps API key not specified" }
val countDownLatch = CountDownLatch(1)
composeTestRule.setContent {
GoogleMapView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MapInColumnTests {
private lateinit var cameraPositionState: CameraPositionState

private fun initMap(content: @Composable () -> Unit = {}) {
check(hasValidApiKey) { "Maps API key not specified" }
val countDownLatch = CountDownLatch(1)
composeTestRule.setContent {
var scrollingEnabled by remember { mutableStateOf(true) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import com.google.android.gms.maps.model.LatLng
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals

val hasValidApiKey: Boolean =
BuildConfig.MAPS_API_KEY.isNotBlank() && BuildConfig.MAPS_API_KEY != "YOUR_API_KEY"

const val assertRoundingError: Double = 0.01

fun LatLng.assertEquals(other: LatLng) {
Expand Down

0 comments on commit 12251ff

Please sign in to comment.