-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepositoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package net.mullvad.mullvadvpn.repository | ||
|
||
import android.content.SharedPreferences | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import net.mullvad.mullvadvpn.lib.common.test.assertLists | ||
import net.mullvad.mullvadvpn.util.IChangelogDataProvider | ||
import org.junit.jupiter.api.Test | ||
|
||
class ChangelogRepositoryTest { | ||
|
||
private val mockedPreferences: SharedPreferences = mockk() | ||
private val mockDataProvider: IChangelogDataProvider = mockk() | ||
|
||
private val changelogRepository = | ||
ChangelogRepository(preferences = mockedPreferences, dataProvider = mockDataProvider) | ||
|
||
@Test | ||
fun `when given a changelog text should return a list of correctly formatted strings`() { | ||
// Arrange | ||
val testChangelog = | ||
"- Added very nice new feature with a very long descriptive message\n" + | ||
" about how it works...\n" + | ||
"- Fixed super bad leak." | ||
val expectedResult = | ||
listOf( | ||
"Added very nice new feature with a very long descriptive message about how it works...", | ||
"Fixed super bad leak." | ||
) | ||
every { mockDataProvider.getChangelog() } returns testChangelog | ||
|
||
// Act | ||
val result = changelogRepository.getLastVersionChanges() | ||
|
||
// Assert | ||
assertLists(expectedResult, result) | ||
} | ||
} |