Skip to content

Commit

Permalink
Adds unknown enum test.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmuvi-stripe committed Sep 20, 2022
1 parent cbc058d commit eb9e059
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,4 @@ data class FinancialConnectionsAccount(
internal const val OBJECT_OLD = "linked_account"
internal const val OBJECT_NEW = "financial_connections.account"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.accounts.data.size).isEqualTo(1)
}
Expand All @@ -52,7 +53,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.accounts.data.size).isEqualTo(1)
}
Expand All @@ -66,7 +68,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.paymentAccount).isInstanceOf(FinancialConnectionsAccount::class.java)
}
Expand All @@ -80,7 +83,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.paymentAccount).isInstanceOf(FinancialConnectionsAccount::class.java)
}
Expand All @@ -94,7 +98,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.paymentAccount).isInstanceOf(FinancialConnectionsAccount::class.java)
}
Expand All @@ -104,16 +109,17 @@ class FinancialConnectionsApiRepositoryTest {
runTest {
givenGetRequestReturns(
readResourceAsString(
"json/linked_account_session_payment_account_as_financial_account.json"
"json/linked_account_session_unknown_permission.json"
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

val paymentAccount = result.paymentAccount
assertThat(paymentAccount).isInstanceOf(FinancialConnectionsAccount::class.java)
assertThat((paymentAccount as FinancialConnectionsAccount).permissions)
.containsExactly(FinancialConnectionsAccount.Permissions.PAYMENT_METHOD)
val result = financialConnectionsApiRepository
.getFinancialConnectionsSession("client_secret")
val financialConnectionsAccount = result.paymentAccount as FinancialConnectionsAccount
assertThat(financialConnectionsAccount.permissions).containsExactly(
FinancialConnectionsAccount.Permissions.PAYMENT_METHOD,
FinancialConnectionsAccount.Permissions.UNKNOWN,
)
}

@Test
Expand All @@ -125,7 +131,8 @@ class FinancialConnectionsApiRepositoryTest {
)
)

val result = financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")
val result =
financialConnectionsApiRepository.getFinancialConnectionsSession("client_secret")

assertThat(result.paymentAccount).isInstanceOf(BankAccount::class.java)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"last4": "5579",
"livemode": true,
"permissions": [
"payment_method",
"hola"
"payment_method"
],
"status": "active",
"subcategory": "credit_card",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "las_dhgfsklhgfkdsjhgk",
"object": "link_account_session",
"client_secret": "las_client_secret_ldafjlfkjlsfadkjk",
"linked_accounts": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/linked_accounts"
},
"livemode": true,
"payment_account": {
"id": "la_dfsdfasfds",
"object": "financial_connections.account",
"balance": null,
"balance_refresh": null,
"category": "credit",
"created": 1648749414,
"display_name": "CREDIT CARD",
"institution_name": "Chase",
"last4": "5579",
"livemode": true,
"permissions": [
"payment_method",
"hola"
],
"status": "active",
"subcategory": "credit_card",
"supported_payment_method_types": [
]
}
}

0 comments on commit eb9e059

Please sign in to comment.