Add test cases for repository instantiation cases
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
e2afff0b8e
commit
41c951b659
@ -45,7 +45,14 @@ class RepositoryTest() {
|
||||
|
||||
@Test
|
||||
fun `Instantiate repository`() {
|
||||
val repository = Repository(api, appSettingsService, connectivityStatus, db)
|
||||
val success = try {
|
||||
Repository(api, appSettingsService, connectivityStatus, db)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
assertEquals(true, success)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -53,14 +60,28 @@ class RepositoryTest() {
|
||||
every { appSettingsService.getApiVersion() } returns -1
|
||||
every { connectivityStatus.isNetworkConnected } returns MutableStateFlow(false)
|
||||
|
||||
val repository = Repository(api, appSettingsService, connectivityStatus, db)
|
||||
val success = try {
|
||||
Repository(api, appSettingsService, connectivityStatus, db)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
assertEquals(true, success)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Instantiate repository with negative stats`() {
|
||||
coEvery { api.stats() } returns SelfossModel.StatusAndData(success = true, data = SelfossModel.Stats(-100, -50, -20))
|
||||
|
||||
val repository = Repository(api, appSettingsService, connectivityStatus, db)
|
||||
val success = try {
|
||||
Repository(api, appSettingsService, connectivityStatus, db)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
assertEquals(true, success)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user