Skip to content

Commit

Permalink
Feature/add configure spotless (#137)
Browse files Browse the repository at this point in the history
* feat: Added spotless copyright templates; renamed old files
* feat: Added spotless gradle plugin
* feat: Applying spotless to app modules (mobile, wearos) files
* feat: Applying spotless to macro benchmark module files
* feat: Applying spotless to core calculator module files
* feat: Renamed composable function in wearos app module: calculator output screen
* feat: Renamed file in wearos app module: calculator output screen
  • Loading branch information
marlonlom authored Sep 10, 2024
1 parent fe6e286 commit 303490d
Show file tree
Hide file tree
Showing 124 changed files with 591 additions and 721 deletions.
2 changes: 1 addition & 1 deletion apps/mobile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
create("benchmark") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("dev.marlonlom.mocca", appContext.packageName)
}

@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("dev.marlonlom.mocca", appContext.packageName)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.input

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand Down Expand Up @@ -30,5 +29,4 @@ internal class MoneyAmountInputUiTest {
}
composeTestRule.onNodeWithText("123").assertIsDisplayed()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.output

import androidx.compose.ui.test.assertIsDisplayed
Expand All @@ -29,7 +28,7 @@ internal class FailureResultSlotUiTest {
FailureResultSlot(
failureState = CalculatorUiState.WithFailure(
amount = "123",
exception = CalculationException.BelowQuantityRange()
exception = CalculationException.BelowQuantityRange(),
),
onSlotClosedAction = {
clicked = true
Expand All @@ -50,7 +49,7 @@ internal class FailureResultSlotUiTest {
FailureResultSlot(
failureState = CalculatorUiState.WithFailure(
amount = "99999999",
exception = CalculationException.AboveQuantityRange()
exception = CalculationException.AboveQuantityRange(),
),
onSlotClosedAction = {
clicked = true
Expand All @@ -71,7 +70,7 @@ internal class FailureResultSlotUiTest {
FailureResultSlot(
failureState = CalculatorUiState.WithFailure(
amount = "-1",
exception = CalculationException.NegativeQuantity()
exception = CalculationException.NegativeQuantity(),
),
onSlotClosedAction = {
clicked = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.output

import androidx.compose.ui.test.assertIsDisplayed
Expand Down Expand Up @@ -32,12 +31,12 @@ internal class SuccessResultSlotUiTest {
response = CalculationResult(
variableFee = 18000.0,
fixedFee = 0.0,
total = 468000.0
)
total = 468000.0,
),
),
onSlotClosedAction = {
clicked = true
}
},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.slots

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand Down Expand Up @@ -34,7 +33,7 @@ internal class ButtonsSectionUiTest {
windowSizeInfo = WindowSizeUtilityDefaults.mobilePortrait,
numberTypingEnabledState = numberTypingEnabledState,
onPerformCalculationAction = { },
onDeleteLastNumberAction = {}
onDeleteLastNumberAction = {},
) {
numberText.append(it)
}
Expand Down Expand Up @@ -64,7 +63,7 @@ internal class ButtonsSectionUiTest {
onPerformCalculationAction = { },
onDeleteLastNumberAction = {
numberText.deleteCharAt(numberText.length - 1)
}
},
) {
numberText.append(it)
}
Expand Down Expand Up @@ -98,7 +97,7 @@ internal class ButtonsSectionUiTest {
},
onDeleteLastNumberAction = {
numberText.deleteCharAt(numberText.length - 1)
}
},
) {
numberText.append(it)
}
Expand All @@ -114,5 +113,4 @@ internal class ButtonsSectionUiTest {
Truth.assertThat(calculationPerformed).isTrue()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.slots

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand Down Expand Up @@ -31,7 +30,7 @@ internal class TopContentSlotUiTest {
windowSizeInfo = WindowSizeUtilityDefaults.mobilePortrait,
calculationTextState = mutableStateOf(amountExpectedValue),
calculatorUiState = CalculatorUiState.Empty,
onSlotClosedAction = {}
onSlotClosedAction = {},
)
}

Expand All @@ -52,10 +51,10 @@ internal class TopContentSlotUiTest {
response = CalculationResult(
variableFee = 18000.0,
fixedFee = 0.0,
total = 468000.0
)
total = 468000.0,
),
),
onSlotClosedAction = {}
onSlotClosedAction = {},
)
}

Expand All @@ -77,7 +76,7 @@ internal class TopContentSlotUiTest {
calculationTextState = mutableStateOf(amountExpectedValue),
calculatorUiState = CalculatorUiState.WithFailure(
amount = amountExpectedValue,
exception = CalculationException.BelowQuantityRange()
exception = CalculationException.BelowQuantityRange(),
),
onSlotClosedAction = {},
)
Expand All @@ -99,9 +98,9 @@ internal class TopContentSlotUiTest {
calculationTextState = mutableStateOf(amountExpectedValue),
calculatorUiState = CalculatorUiState.WithFailure(
amount = amountExpectedValue,
exception = CalculationException.AboveQuantityRange()
exception = CalculationException.AboveQuantityRange(),
),
onSlotClosedAction = {}
onSlotClosedAction = {},
)
}
composeTestRule
Expand All @@ -121,9 +120,9 @@ internal class TopContentSlotUiTest {
calculationTextState = mutableStateOf(amountExpectedValue),
calculatorUiState = CalculatorUiState.WithFailure(
amount = amountExpectedValue,
exception = CalculationException.NegativeQuantity()
exception = CalculationException.NegativeQuantity(),
),
onSlotClosedAction = {}
onSlotClosedAction = {},
)
}
composeTestRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.calculator.utils

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand All @@ -24,7 +23,7 @@ object WindowSizeUtilityDefaults {
val mobilePortrait
get() = WindowSizeInfo(
windowSizeClass = WindowSizeClass.calculateFromSize(
DpSize(360.dp, 640.dp)
DpSize(360.dp, 640.dp),
),
devicePosture = DevicePosture.NormalPosture,
isLandscape = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings

import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -59,7 +58,7 @@ internal class SettingsRepositoryTest {
aboutEfectyUrl = "https://efecty.com/about",
appVersion = "1.0.0",
darkTheme = false,
dynamicColors = true
dynamicColors = true,
)
repository!!.saveDefaults(expectedSettings)
val preferences = repository!!.settingsFlow.first()
Expand All @@ -79,7 +78,7 @@ internal class SettingsRepositoryTest {
aboutEfectyUrl = "https://efecty.com/about",
appVersion = "1.0.0",
darkTheme = false,
dynamicColors = true
dynamicColors = true,
)
repository!!.saveDefaults(expectedSettings)
repository!!.toggleBooleanPreference("dark_theme", !expectedSettings.darkTheme)
Expand All @@ -93,5 +92,4 @@ internal class SettingsRepositoryTest {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings

import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -47,7 +46,7 @@ internal class SettingsViewModelTest {
aboutEfectyUrl = "https://efecty.com/about",
appVersion = "1.0.0",
darkTheme = false,
dynamicColors = true
dynamicColors = true,
)
repository!!.saveDefaults(expectedSettings)
val preferences = viewModel!!.settingsUiState.first()
Expand All @@ -67,7 +66,7 @@ internal class SettingsViewModelTest {
aboutEfectyUrl = "https://efecty.com/about",
appVersion = "1.0.0",
darkTheme = false,
dynamicColors = true
dynamicColors = true,
)
repository!!.saveDefaults(expectedSettings)
viewModel!!.toggleBooleanPreference("dark_theme", !expectedSettings.darkTheme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings

import android.content.Context
Expand All @@ -23,7 +22,7 @@ object TestablePreferencesDataStore {
produceFile = {
val testContext: Context = InstrumentationRegistry.getInstrumentation().targetContext
testContext.preferencesDataStoreFile(name = "test_mocca_settings")
}
},
).also { instance = it }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings.parts

import androidx.compose.ui.test.assertIsDisplayed
Expand Down Expand Up @@ -32,7 +31,7 @@ internal class BooleanSettingSwitchUiTest {
onChecked = {
checked = it
},
showSubtitle = false
showSubtitle = false,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings.parts

import androidx.compose.ui.test.assertIsDisplayed
Expand Down Expand Up @@ -31,7 +30,7 @@ internal class ClickableTextRowUiTest {
title = R.string.text_settings_label_feedback,
onClicked = {
clicked = true
}
},
)
}
val nodeWithText = onNodeWithText("Feedback")
Expand All @@ -51,7 +50,7 @@ internal class ClickableTextRowUiTest {
subtitle = BuildConfig.BUILD_TYPE,
onClicked = {
clicked = true
}
},
)
}

Expand All @@ -61,5 +60,4 @@ internal class ClickableTextRowUiTest {
Truth.assertThat(clicked).isTrue()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2024 Marlonlom
* SPDX-License-Identifier: Apache-2.0
*/

package dev.marlonlom.mocca.feats.settings.parts

import androidx.compose.ui.test.assertIsDisplayed
Expand Down Expand Up @@ -36,13 +35,12 @@ internal class SettingLabelTextUiTest {
setContent {
SettingLabelText(
title = R.string.text_settings_label_app_version,
subtitle = BuildConfig.VERSION_NAME
subtitle = BuildConfig.VERSION_NAME,
)
}

onNodeWithText("Version").assertIsDisplayed()
onNodeWithText(BuildConfig.VERSION_NAME).assertIsDisplayed()
}
}

}
Loading

0 comments on commit 303490d

Please sign in to comment.