Skip to content

Commit

Permalink
Merge branch 'deterministically-use-trailing-commas-in-kotlin-code-dr…
Browse files Browse the repository at this point in the history
…oid-89'
  • Loading branch information
albin-mullvad committed Aug 29, 2024
2 parents 3286d40 + 981e97d commit 1ee762f
Show file tree
Hide file tree
Showing 362 changed files with 2,004 additions and 2,296 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import androidx.compose.ui.test.longClick
import androidx.compose.ui.test.performTouchInput

fun SemanticsNodeInteraction.performLongClick(): SemanticsNodeInteraction {
@OptIn(ExperimentalTestApi::class) return this.invokeGlobalAssertions().performLongClickImpl()
@OptIn(ExperimentalTestApi::class)
return this.invokeGlobalAssertions().performLongClickImpl()
}

private fun SemanticsNodeInteraction.performLongClickImpl(): SemanticsNodeInteraction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fun SemanticsNodeInteractionsProvider.onNodeWithTagAndText(
text: String,
substring: Boolean = false,
ignoreCase: Boolean = false,
useUnmergedTree: Boolean = false
useUnmergedTree: Boolean = false,
): SemanticsNodeInteraction =
onNode(hasTestTag(testTag).and(hasText(text, substring, ignoreCase)), useUnmergedTree)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ val DIRECT_ACCESS_METHOD =
id = ApiAccessMethodId.fromString(UUID1),
name = ApiAccessMethodName.fromString("Direct"),
enabled = true,
apiAccessMethod = ApiAccessMethod.Direct
apiAccessMethod = ApiAccessMethod.Direct,
)

val CUSTOM_ACCESS_METHOD =
Expand All @@ -28,6 +28,6 @@ val CUSTOM_ACCESS_METHOD =
ip = "1.1.1.1",
port = Port(123),
password = "Password",
cipher = Cipher.RC4
)
cipher = Cipher.RC4,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,22 @@ private val DUMMY_RELAY_1 =
id =
GeoLocationId.Hostname(
city = GeoLocationId.City(GeoLocationId.Country("RCo1"), "Relay City 1"),
"Relay host 1"
"Relay host 1",
),
active = true,
provider =
Provider(
providerId = ProviderId("PROVIDER RENTED"),
ownership = Ownership.Rented,
)
Provider(providerId = ProviderId("PROVIDER RENTED"), ownership = Ownership.Rented),
)
private val DUMMY_RELAY_2 =
RelayItem.Location.Relay(
id =
GeoLocationId.Hostname(
city = GeoLocationId.City(GeoLocationId.Country("RCo2"), "Relay City 2"),
"Relay host 2"
"Relay host 2",
),
active = true,
provider =
Provider(providerId = ProviderId("PROVIDER OWNED"), ownership = Ownership.MullvadOwned)
Provider(providerId = ProviderId("PROVIDER OWNED"), ownership = Ownership.MullvadOwned),
)
private val DUMMY_RELAY_CITY_1 =
RelayItem.Location.City(
Expand All @@ -53,25 +50,21 @@ private val DUMMY_RELAY_COUNTRY_1 =
RelayItem.Location.Country(
name = "Relay Country 1",
id = GeoLocationId.Country("RCo1"),
cities = listOf(DUMMY_RELAY_CITY_1)
cities = listOf(DUMMY_RELAY_CITY_1),
)
private val DUMMY_RELAY_COUNTRY_2 =
RelayItem.Location.Country(
name = "Relay Country 2",
id = GeoLocationId.Country("RCo2"),
cities = listOf(DUMMY_RELAY_CITY_2)
cities = listOf(DUMMY_RELAY_CITY_2),
)

private val DUMMY_WIREGUARD_PORT_RANGES = ArrayList<PortRange>()
private val DUMMY_WIREGUARD_ENDPOINT_DATA = WireguardEndpointData(DUMMY_WIREGUARD_PORT_RANGES)

val DUMMY_RELAY_COUNTRIES = listOf(DUMMY_RELAY_COUNTRY_1, DUMMY_RELAY_COUNTRY_2)

val DUMMY_RELAY_LIST =
RelayList(
DUMMY_RELAY_COUNTRIES,
DUMMY_WIREGUARD_ENDPOINT_DATA,
)
val DUMMY_RELAY_LIST = RelayList(DUMMY_RELAY_COUNTRIES, DUMMY_WIREGUARD_ENDPOINT_DATA)

val DUMMY_RELAY_ITEM_CUSTOM_LISTS =
listOf(
Expand All @@ -80,31 +73,31 @@ val DUMMY_RELAY_ITEM_CUSTOM_LISTS =
CustomList(
name = CustomListName.fromString("First list"),
id = CustomListId("1"),
locations = emptyList()
locations = emptyList(),
),
locations = DUMMY_RELAY_COUNTRIES
locations = DUMMY_RELAY_COUNTRIES,
),
RelayItem.CustomList(
customList =
CustomList(
name = CustomListName.fromString("Empty list"),
id = CustomListId("2"),
locations = emptyList()
locations = emptyList(),
),
locations = emptyList()
)
locations = emptyList(),
),
)

val DUMMY_CUSTOM_LISTS =
listOf(
CustomList(
name = CustomListName.fromString("First list"),
id = CustomListId("1"),
locations = DUMMY_RELAY_COUNTRIES.map { it.id }
locations = DUMMY_RELAY_COUNTRIES.map { it.id },
),
CustomList(
name = CustomListName.fromString("Empty list"),
id = CustomListId("2"),
locations = emptyList()
)
locations = emptyList(),
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CustomPortDialogTest {
initialPort = initialPort,
allowedPortRanges = allowedPortRanges,
onSave = onSave,
onDismiss = onDismiss
onDismiss = onDismiss,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DeleteCustomListConfirmationDialogTest {
val name = CustomListName.fromString("List should be deleted")
setContentWithTheme {
DeleteCustomListConfirmationDialog(
state = DeleteCustomListUiState(name = name, deleteError = null),
state = DeleteCustomListUiState(name = name, deleteError = null)
)
}

Expand All @@ -49,7 +49,7 @@ class DeleteCustomListConfirmationDialogTest {
setContentWithTheme {
DeleteCustomListConfirmationDialog(
state = DeleteCustomListUiState(name = name, deleteError = null),
onDelete = mockedOnDelete
onDelete = mockedOnDelete,
)
}

Expand All @@ -69,7 +69,7 @@ class DeleteCustomListConfirmationDialogTest {
setContentWithTheme {
DeleteCustomListConfirmationDialog(
state = DeleteCustomListUiState(name = name, deleteError = null),
onBack = mockedOnBack
onBack = mockedOnBack,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DnsDialogTest {
validationError = null,
isLocal = false,
isAllowLanEnabled = false,
index = null
index = null,
)

@SuppressLint("ComposableNaming")
Expand All @@ -34,7 +34,7 @@ class DnsDialogTest {
onDnsInputChange: (String) -> Unit = { _ -> },
onSaveDnsClick: () -> Unit = {},
onRemoveDnsClick: (Int) -> Unit = {},
onDismiss: () -> Unit = {}
onDismiss: () -> Unit = {},
) {
DnsDialog(state, onDnsInputChange, onSaveDnsClick, onRemoveDnsClick, onDismiss)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MtuDialogTest {
onInputChanged = onInputChanged,
onSaveMtu = onSaveMtu,
onResetMtu = onResetMtu,
onDismiss = onDismiss
onDismiss = onDismiss,
)
}

Expand All @@ -62,11 +62,7 @@ class MtuDialogTest {
fun testMtuDialogWithEditValue() =
composeExtension.use {
// Arrange
setContentWithTheme {
testMtuDialog(
mtuInput = VALID_DUMMY_MTU_VALUE,
)
}
setContentWithTheme { testMtuDialog(mtuInput = VALID_DUMMY_MTU_VALUE) }

// Assert
onNodeWithText(VALID_DUMMY_MTU_VALUE).assertExists()
Expand All @@ -78,10 +74,7 @@ class MtuDialogTest {
// Arrange
val mockedSubmitHandler: (String) -> Unit = mockk(relaxed = true)
setContentWithTheme {
testMtuDialog(
VALID_DUMMY_MTU_VALUE,
onSaveMtu = mockedSubmitHandler,
)
testMtuDialog(VALID_DUMMY_MTU_VALUE, onSaveMtu = mockedSubmitHandler)
}

// Act
Expand All @@ -107,10 +100,7 @@ class MtuDialogTest {
// Arrange
val mockedClickHandler: () -> Unit = mockk(relaxed = true)
setContentWithTheme {
testMtuDialog(
mtuInput = VALID_DUMMY_MTU_VALUE,
onResetMtu = mockedClickHandler,
)
testMtuDialog(mtuInput = VALID_DUMMY_MTU_VALUE, onResetMtu = mockedClickHandler)
}

// Act
Expand All @@ -125,11 +115,7 @@ class MtuDialogTest {
composeExtension.use {
// Arrange
val mockedClickHandler: () -> Unit = mockk(relaxed = true)
setContentWithTheme {
testMtuDialog(
onDismiss = mockedClickHandler,
)
}
setContentWithTheme { testMtuDialog(onDismiss = mockedClickHandler) }

// Assert
onNodeWithText("Cancel").performClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ResetServerIPOverridesConfirmationDialogTest {
setContentWithTheme {
ResetServerIpOverridesConfirmationDialog(
onNavigateBack = clickHandler,
onClearAllOverrides = {}
onClearAllOverrides = {},
)
}

Expand All @@ -54,7 +54,7 @@ class ResetServerIPOverridesConfirmationDialogTest {
setContentWithTheme {
ResetServerIpOverridesConfirmationDialog(
onNavigateBack = {},
onClearAllOverrides = clickHandler
onClearAllOverrides = clickHandler,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SaveApiAccessMethodDialogTest {
state =
SaveApiAccessMethodUiState(
testingState = TestApiAccessMethodState.Testing,
isSaving = false
isSaving = false,
)
)
}
Expand All @@ -48,7 +48,7 @@ class SaveApiAccessMethodDialogTest {
state =
SaveApiAccessMethodUiState(
testingState = TestApiAccessMethodState.Result.Failure,
isSaving = false
isSaving = false,
)
)
}
Expand All @@ -67,7 +67,7 @@ class SaveApiAccessMethodDialogTest {
state =
SaveApiAccessMethodUiState(
testingState = TestApiAccessMethodState.Result.Successful,
isSaving = true
isSaving = true,
)
)
}
Expand All @@ -87,9 +87,9 @@ class SaveApiAccessMethodDialogTest {
state =
SaveApiAccessMethodUiState(
testingState = TestApiAccessMethodState.Testing,
isSaving = false
isSaving = false,
),
onCancel = onCancelClick
onCancel = onCancelClick,
)
}

Expand All @@ -110,9 +110,9 @@ class SaveApiAccessMethodDialogTest {
state =
SaveApiAccessMethodUiState(
testingState = TestApiAccessMethodState.Result.Failure,
isSaving = false
isSaving = false,
),
onSave = onSaveClick
onSave = onSaveClick,
)
}

Expand Down
Loading

0 comments on commit 1ee762f

Please sign in to comment.