Skip to content

Commit

Permalink
clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
toluo-stripe committed Jan 22, 2025
1 parent 357bb2a commit 4c4c2d4
Showing 1 changed file with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,18 @@ class LinkApiRepositoryTest {

@Test
fun `lookupConsumer sends correct parameters`() = runTest {
val email = "[email protected]"
val consumersApiService = FakeConsumersApiService()
val linkRepository = linkRepository(consumersApiService)

val result = linkRepository.lookupConsumer(email)
val result = linkRepository.lookupConsumer(EMAIL)

assertThat(result).isEqualTo(Result.success(TestFactory.CONSUMER_SESSION_LOOKUP))
assertThat(consumersApiService.lookupCalls).containsExactly(
FakeConsumersApiService.LookupCall(
email = email,
requestSurface = CONSUMER_SURFACE,
requestOptions = ApiRequest.Options(PUBLISHABLE_KEY, STRIPE_ACCOUNT_ID)
)
)
assertThat(consumersApiService.lookupCalls.size).isEqualTo(1)
val lookup = consumersApiService.lookupCalls.first()
assertThat(lookup.email).isEqualTo(EMAIL)
assertThat(lookup.requestSurface).isEqualTo(CONSUMER_SURFACE)
assertThat(lookup.requestOptions.apiKey).isEqualTo(PUBLISHABLE_KEY)
assertThat(lookup.requestOptions.stripeAccount).isEqualTo(STRIPE_ACCOUNT_ID)
}

@Test
Expand Down Expand Up @@ -116,17 +114,16 @@ class LinkApiRepositoryTest {
)

assertThat(result).isEqualTo(Result.success(TestFactory.CONSUMER_SESSION_LOOKUP))
assertThat(consumersApiService.mobileLookupCalls).containsExactly(
FakeConsumersApiService.MobileLookupCall(
email = EMAIL,
requestSurface = CONSUMER_SURFACE,
verificationToken = VERIFICATION_TOKEN,
appId = APP_ID,
emailSource = EMAIL_SOURCE,
sessionId = SESSION_ID,
requestOptions = ApiRequest.Options(PUBLISHABLE_KEY, STRIPE_ACCOUNT_ID)
)
)
assertThat(consumersApiService.mobileLookupCalls.size).isEqualTo(1)
val lookup = consumersApiService.mobileLookupCalls.first()
assertThat(lookup.email).isEqualTo(EMAIL)
assertThat(lookup.requestSurface).isEqualTo(CONSUMER_SURFACE)
assertThat(lookup.verificationToken).isEqualTo(VERIFICATION_TOKEN)
assertThat(lookup.appId).isEqualTo(APP_ID)
assertThat(lookup.emailSource).isEqualTo(EMAIL_SOURCE)
assertThat(lookup.sessionId).isEqualTo(SESSION_ID)
assertThat(lookup.requestOptions.apiKey).isEqualTo(PUBLISHABLE_KEY)
assertThat(lookup.requestOptions.stripeAccount).isEqualTo(STRIPE_ACCOUNT_ID)
}

@Test
Expand Down

0 comments on commit 4c4c2d4

Please sign in to comment.