diff --git a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt index cc498a2..b18f653 100644 --- a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt +++ b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt @@ -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