Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Dec 12, 2023
1 parent c1ccc7a commit 074fd19
Show file tree
Hide file tree
Showing 123 changed files with 1,589 additions and 1,806 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import org.junit.Test

@OptIn(ExperimentalMaterial3Api::class)
class AccountScreenTest {
@get:Rule val composeTestRule = createComposeRule()
@get:Rule
val composeTestRule = createComposeRule()

@Before
fun setup() {
Expand All @@ -42,8 +43,7 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
uiState = AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null,
Expand All @@ -67,8 +67,7 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
uiState = AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null,
Expand All @@ -93,8 +92,7 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
uiState = AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null,
Expand All @@ -119,8 +117,7 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
uiState = AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null,
Expand All @@ -144,12 +141,9 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
paymentDialogData =
PurchaseResult.Completed.Success.toPaymentDialogData(),
),
uiState = AccountUiState.default().copy(
paymentDialogData = PurchaseResult.Completed.Success.toPaymentDialogData(),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -165,12 +159,10 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
paymentDialogData =
PurchaseResult.Error.VerificationError(null).toPaymentDialogData(),
),
uiState = AccountUiState.default().copy(
paymentDialogData = PurchaseResult.Error.VerificationError(null)
.toPaymentDialogData(),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -186,13 +178,12 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
paymentDialogData =
PurchaseResult.Error.FetchProductsError(ProductId(""), null)
.toPaymentDialogData(),
),
uiState = AccountUiState.default().copy(
paymentDialogData = PurchaseResult.Error.FetchProductsError(
ProductId(""),
null,
).toPaymentDialogData(),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -208,8 +199,8 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default().copy(billingPaymentState = PaymentState.Error.Billing),
uiState = AccountUiState.default()
.copy(billingPaymentState = PaymentState.Error.Billing),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -228,12 +219,13 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct)),
uiState = AccountUiState.default().copy(
billingPaymentState = PaymentState.PaymentAvailable(
listOf(
mockPaymentProduct,
),
),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -252,12 +244,13 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct)),
uiState = AccountUiState.default().copy(
billingPaymentState = PaymentState.PaymentAvailable(
listOf(
mockPaymentProduct,
),
),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -276,12 +269,13 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct)),
uiState = AccountUiState.default().copy(
billingPaymentState = PaymentState.PaymentAvailable(
listOf(
mockPaymentProduct,
),
),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -291,11 +285,9 @@ class AccountScreenTest {
composeTestRule.onNodeWithTag(PLAY_PAYMENT_INFO_ICON_TEST_TAG).performClick()

// Assert
composeTestRule
.onNodeWithText(
"We are currently verifying your purchase, this might take some time. Your time will be added if the verification is successful.",
)
.assertExists()
composeTestRule.onNodeWithText(
"We are currently verifying your purchase, this might take some time. Your time will be added if the verification is successful.",
).assertExists()
}

@Test
Expand All @@ -307,12 +299,13 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct)),
uiState = AccountUiState.default().copy(
billingPaymentState = PaymentState.PaymentAvailable(
listOf(
mockPaymentProduct,
),
),
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
)
Expand All @@ -333,12 +326,13 @@ class AccountScreenTest {
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct)),
uiState = AccountUiState.default().copy(
billingPaymentState = PaymentState.PaymentAvailable(
listOf(
mockPaymentProduct,
),
),
),
onPurchaseBillingProductClick = clickHandler,
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import org.junit.Rule
import org.junit.Test

class ChangelogDialogTest {
@get:Rule val composeTestRule = createComposeRule()
@get:Rule
val composeTestRule = createComposeRule()

@MockK lateinit var mockedViewModel: ChangelogViewModel
@MockK
lateinit var mockedViewModel: ChangelogViewModel

@Before
fun setup() {
Expand All @@ -31,8 +33,11 @@ class ChangelogDialogTest {
@Test
fun testShowChangeLogWhenNeeded() {
// Arrange
every { mockedViewModel.uiState } returns
MutableStateFlow(ChangelogDialogUiState.Show(listOf(CHANGELOG_ITEM)))
every { mockedViewModel.uiState } returns MutableStateFlow(
ChangelogDialogUiState.Show(
listOf(CHANGELOG_ITEM),
),
)
every { mockedViewModel.dismissChangelogDialog() } just Runs

composeTestRule.setContentWithTheme {
Expand Down
Loading

0 comments on commit 074fd19

Please sign in to comment.