diff options
| author | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-09-30 15:41:10 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-10-01 08:59:39 +0200 |
| commit | e5e5ddce0b0e83da75e6e47aa63999ad8eb96f05 (patch) | |
| tree | b443eefd7ef4733824d4d70c7aa2bec8b959f4fb /android/app/src/test | |
| parent | 7a29bd5ff6214ecde832539942e02f6dde22b15f (diff) | |
| download | mullvadvpn-e5e5ddce0b0e83da75e6e47aa63999ad8eb96f05.tar.xz mullvadvpn-e5e5ddce0b0e83da75e6e47aa63999ad8eb96f05.zip | |
Sort custom lists alphabetically
Diffstat (limited to 'android/app/src/test')
| -rw-r--r-- | android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt index dc34a19430..1c8687f3b0 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt @@ -239,6 +239,42 @@ class CustomListsRepositoryTest { assertEquals(expectedResult, result) } + @Test + fun `custom lists should be sorted alphabetically by name`() = runTest { + // Arrange + val customListId1 = CustomListId("1") + val customListId2 = CustomListId("2") + val customListId3 = CustomListId("3") + val customList1 = + CustomList( + id = customListId1, + name = CustomListName.fromString("Z List"), + locations = emptyList(), + ) + val customList2 = + CustomList( + id = customListId2, + name = CustomListName.fromString("A List"), + locations = emptyList(), + ) + val customList3 = + CustomList( + id = customListId3, + name = CustomListName.fromString("M List"), + locations = emptyList(), + ) + val mockSettings: Settings = mockk() + every { mockSettings.customLists } returns listOf(customList1, customList2, customList3) + settingsFlow.value = mockSettings + + // Act + val result = customListsRepository.customLists.value + + // Assert + val expectedOrder = listOf(customList2, customList3, customList1) + assertEquals(expectedOrder, result) + } + companion object { private const val RELAY_LIST_EXTENSIONS = "net.mullvad.mullvadvpn.relaylist.RelayListExtensionsKt" |
