Issue#11 Fix codeAnalysis errors
This commit is contained in:
parent
8ae94cfe92
commit
b52652ed67
6 changed files with 21 additions and 28 deletions
|
|
@ -56,23 +56,21 @@ internal class FavouriteContentLocalStorageImplTest : KoinTest {
|
||||||
/** GIVEN content_id added WHEN removed to Favourite THEN it no longer can be read out */
|
/** GIVEN content_id added WHEN removed to Favourite THEN it no longer can be read out */
|
||||||
@Test
|
@Test
|
||||||
fun contentIdAddedThenRemovedCanNoLongerBeReadOut() = runTest(testDispatcher) {
|
fun contentIdAddedThenRemovedCanNoLongerBeReadOut() = runTest(testDispatcher) {
|
||||||
val expected = listOf<ContentId>()
|
val expected = listOf<ContentId>()
|
||||||
sut.markAsFavourite(ContentId("b"))
|
sut.markAsFavourite(ContentId("b"))
|
||||||
|
|
||||||
sut.deleteAsFavourite(ContentId("b"))
|
sut.deleteAsFavourite(ContentId("b"))
|
||||||
val actual = sut.observeFavourites().first()
|
val actual = sut.observeFavourites().first()
|
||||||
|
|
||||||
Assert.assertEquals(expected, actual)
|
Assert.assertEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GIVEN empty database WHILE observing content WHEN favourite added THEN change is emitted */
|
/** GIVEN empty database WHILE observing content WHEN favourite added THEN change is emitted */
|
||||||
@Test
|
@Test
|
||||||
fun addingFavouriteUpdatesExistingObservers() = runTest(testDispatcher) {
|
fun addingFavouriteUpdatesExistingObservers() = runTest(testDispatcher) {
|
||||||
val expected = listOf(listOf(), listOf(ContentId("a")))
|
val expected = listOf(listOf(), listOf(ContentId("a")))
|
||||||
|
|
||||||
val actual = async(coroutineContext) {
|
val actual = async(coroutineContext) { sut.observeFavourites().take(2).toList() }
|
||||||
sut.observeFavourites().take(2).toList()
|
|
||||||
}
|
|
||||||
advanceUntilIdle()
|
advanceUntilIdle()
|
||||||
|
|
||||||
sut.markAsFavourite(ContentId("a"))
|
sut.markAsFavourite(ContentId("a"))
|
||||||
|
|
@ -84,17 +82,17 @@ internal class FavouriteContentLocalStorageImplTest : KoinTest {
|
||||||
/** GIVEN non empty database WHILE observing content WHEN favourite removed THEN change is emitted */
|
/** GIVEN non empty database WHILE observing content WHEN favourite removed THEN change is emitted */
|
||||||
@Test
|
@Test
|
||||||
fun removingFavouriteUpdatesExistingObservers() = runTest(testDispatcher) {
|
fun removingFavouriteUpdatesExistingObservers() = runTest(testDispatcher) {
|
||||||
val expected = listOf(listOf(ContentId("a")), listOf())
|
val expected = listOf(listOf(ContentId("a")), listOf())
|
||||||
sut.markAsFavourite(ContentId("a"))
|
sut.markAsFavourite(ContentId("a"))
|
||||||
|
|
||||||
val actual = async(coroutineContext) {
|
val actual = async(coroutineContext) {
|
||||||
sut.observeFavourites().take(2).toList()
|
sut.observeFavourites().take(2).toList()
|
||||||
}
|
}
|
||||||
advanceUntilIdle()
|
|
||||||
|
|
||||||
sut.deleteAsFavourite(ContentId("a"))
|
|
||||||
advanceUntilIdle()
|
advanceUntilIdle()
|
||||||
|
|
||||||
Assert.assertEquals(expected, actual.getCompleted())
|
sut.deleteAsFavourite(ContentId("a"))
|
||||||
}
|
advanceUntilIdle()
|
||||||
|
|
||||||
|
Assert.assertEquals(expected, actual.getCompleted())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
||||||
import org.fnives.test.showcase.model.content.ContentId
|
import org.fnives.test.showcase.model.content.ContentId
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Assertions.assertThrows
|
import org.junit.jupiter.api.Assertions.assertThrows
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
package org.fnives.test.showcase.core.content
|
package org.fnives.test.showcase.core.content
|
||||||
|
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.take
|
import kotlinx.coroutines.flow.take
|
||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
||||||
import org.fnives.test.showcase.model.content.Content
|
import org.fnives.test.showcase.model.content.Content
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package org.fnives.test.showcase.core.content
|
package org.fnives.test.showcase.core.content
|
||||||
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage
|
||||||
import org.fnives.test.showcase.model.content.ContentId
|
import org.fnives.test.showcase.model.content.ContentId
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.fnives.test.showcase.core.login.koin
|
package org.fnives.test.showcase.core.login.koin
|
||||||
|
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.fnives.test.showcase.core.content.ContentRepository
|
import org.fnives.test.showcase.core.content.ContentRepository
|
||||||
import org.fnives.test.showcase.core.di.koin.createCoreModule
|
import org.fnives.test.showcase.core.di.koin.createCoreModule
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
project.ext {
|
project.ext {
|
||||||
androidx_core_version = "1.7.0"
|
androidx_core_version = "1.7.0"
|
||||||
androidx_appcompat_version = "1.4.0"
|
androidx_appcompat_version = "1.4.1"
|
||||||
androidx_material_version = "1.4.0"
|
androidx_material_version = "1.5.0"
|
||||||
androidx_constraintlayout_version = "2.1.2"
|
androidx_constraintlayout_version = "2.1.3"
|
||||||
androidx_livedata_version = "2.4.0"
|
androidx_livedata_version = "2.4.0"
|
||||||
androidx_swiperefreshlayout_version = "1.1.0"
|
androidx_swiperefreshlayout_version = "1.1.0"
|
||||||
androidx_room_version = "2.4.0"
|
androidx_room_version = "2.4.1"
|
||||||
activity_ktx_version = "1.4.0"
|
activity_ktx_version = "1.4.0"
|
||||||
|
|
||||||
coroutines_version = "1.6.0"
|
coroutines_version = "1.6.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue