Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brnunes-stripe committed May 24, 2021
1 parent 1df74a7 commit c0dd78e
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.stripe.android.googlepay

import android.graphics.Color
import androidx.arch.core.executor.testing.CountingTaskExecutorRule
import androidx.test.core.app.ApplicationProvider
import com.google.common.truth.Truth.assertThat
import com.stripe.android.ApiKeyFixtures
Expand All @@ -16,10 +15,8 @@ import com.stripe.android.networking.ApiRequest
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import org.json.JSONObject
import org.junit.Rule
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import java.util.concurrent.TimeUnit
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand All @@ -31,10 +28,6 @@ class StripeGooglePayViewModelTest {

private val viewModel: StripeGooglePayViewModel by lazy { createViewModel() }

@Rule
@JvmField
val countingTaskExecutorRule = CountingTaskExecutorRule()

@BeforeTest
fun setup() {
PaymentConfiguration.init(
Expand Down Expand Up @@ -169,7 +162,7 @@ class StripeGooglePayViewModelTest {

@Test
fun `createPaymentMethod() with stripeAccount should include stripeAccount in request`() {
val stripeAccout = "account_id"
val stripeAccount = "account_id"
var requestOptions: ApiRequest.Options? = null
val stripeRepository = object : AbsFakeStripeRepository() {
override suspend fun createPaymentMethod(
Expand All @@ -183,7 +176,7 @@ class StripeGooglePayViewModelTest {
val viewModel = StripeGooglePayViewModel(
ApplicationProvider.getApplicationContext(),
ApiKeyFixtures.FAKE_PUBLISHABLE_KEY,
stripeAccout,
stripeAccount,
ARGS,
stripeRepository,
"App Name",
Expand All @@ -195,10 +188,8 @@ class StripeGooglePayViewModelTest {
)

viewModel.createPaymentMethod(params).observeForever {
assertThat(requestOptions?.stripeAccount).isEqualTo(stripeAccout)
assertThat(requestOptions?.stripeAccount).isEqualTo(stripeAccount)
}

countingTaskExecutorRule.drainTasks(3, TimeUnit.SECONDS)
}

private fun createViewModel(
Expand Down

0 comments on commit c0dd78e

Please sign in to comment.