More cleaning.

This commit is contained in:
aminecmi 2022-12-14 20:25:52 +01:00
parent 7cfd17231a
commit 284c19ef89

View File

@ -369,14 +369,7 @@ class RepositoryTest {
@Test
fun get_tags() {
val tags = listOf(
SelfossModel.Tag("test", "red", 6),
SelfossModel.Tag("second", "yellow", 0)
)
val tagsDB = listOf(
TAG("test_DB", "red", 6),
TAG("second_DB", "yellow", 0)
)
val (tags, tagsDB) = prepareTags()
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
@ -396,17 +389,7 @@ class RepositoryTest {
@Test
fun get_tags_with_sources_update_disabled() {
val tags = listOf(
SelfossModel.Tag("test", "red", 6),
SelfossModel.Tag("second", "yellow", 0)
)
val tagsDB = listOf(
TAG("test_DB", "red", 6),
TAG("second_DB", "yellow", 0)
)
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
val (tags, tagsDB) = prepareTags()
every { appSettingsService.isUpdateSourcesEnabled() } returns false
every { appSettingsService.isItemCachingEnabled() } returns true
@ -443,17 +426,7 @@ class RepositoryTest {
@Test
fun get_tags_with_sources_update_and_items_caching_disabled() {
val tags = listOf(
SelfossModel.Tag("test", "red", 6),
SelfossModel.Tag("second", "yellow", 0)
)
val tagsDB = listOf(
TAG("test_DB", "red", 6),
TAG("second_DB", "yellow", 0)
)
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
val (tags, tagsDB) = prepareTags()
every { appSettingsService.isUpdateSourcesEnabled() } returns false
every { appSettingsService.isItemCachingEnabled() } returns false
@ -472,17 +445,7 @@ class RepositoryTest {
@Test
fun get_tags_without_connection() {
val tags = listOf(
SelfossModel.Tag("test", "red", 6),
SelfossModel.Tag("second", "yellow", 0)
)
val tagsDB = listOf(
TAG("test_DB", "red", 6),
TAG("second_DB", "yellow", 0)
)
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
val (tags, tagsDB) = prepareTags()
every { appSettingsService.isUpdateSourcesEnabled() } returns true
every { appSettingsService.isItemCachingEnabled() } returns true
@ -517,17 +480,7 @@ class RepositoryTest {
@Test
fun get_tags_without_connection_and_sources_update_disabled() {
val tags = listOf(
SelfossModel.Tag("test", "red", 6),
SelfossModel.Tag("second", "yellow", 0)
)
val tagsDB = listOf(
TAG("test_DB", "red", 6),
TAG("second_DB", "yellow", 0)
)
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
val (tags, tagsDB) = prepareTags()
every { appSettingsService.isUpdateSourcesEnabled() } returns false
every { appSettingsService.isItemCachingEnabled() } returns true
@ -634,47 +587,10 @@ class RepositoryTest {
@Test
fun get_sources_with_sources_update_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second DB source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val (sources, sourcesDB) = prepareSources()
every { appSettingsService.isUpdateSourcesEnabled() } returns false
every { appSettingsService.isItemCachingEnabled() } returns true
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository()
var testSources: List<SelfossModel.Source>?
runBlocking {
@ -691,47 +607,10 @@ class RepositoryTest {
@Test
fun get_sources_with_items_caching_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val (sources, _) = prepareSources()
every { appSettingsService.isUpdateSourcesEnabled() } returns true
every { appSettingsService.isItemCachingEnabled() } returns false
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository()
var testSources: List<SelfossModel.Source>?
runBlocking {
@ -745,47 +624,10 @@ class RepositoryTest {
@Test
fun get_sources_with_sources_update_and_items_caching_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val (sources, _) = prepareSources()
every { appSettingsService.isUpdateSourcesEnabled() } returns false
every { appSettingsService.isItemCachingEnabled() } returns false
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository()
var testSources: List<SelfossModel.Source>?
runBlocking {
@ -813,47 +655,10 @@ class RepositoryTest {
@Test
fun get_sources_without_connection_and_items_caching_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First DB source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
prepareSources()
every { appSettingsService.isItemCachingEnabled() } returns false
every { appSettingsService.isUpdateSourcesEnabled() } returns true
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository(MutableStateFlow(false))
var testSources: List<SelfossModel.Source>?
runBlocking {
@ -867,47 +672,10 @@ class RepositoryTest {
@Test
fun get_sources_without_connection_and_sources_update_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First DB source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val (_, sourcesDB) = prepareSources()
every { appSettingsService.isItemCachingEnabled() } returns true
every { appSettingsService.isUpdateSourcesEnabled() } returns false
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository(MutableStateFlow(false))
var testSources: List<SelfossModel.Source>?
runBlocking {
@ -921,47 +689,10 @@ class RepositoryTest {
@Test
fun get_sources_without_connection_and_items_caching_and_sources_update_disabled() {
val sources = arrayListOf(
SelfossModel.Source(
1,
"First source",
listOf("Test", "second"),
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SelfossModel.Source(
2,
"Second source",
listOf("second"),
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val sourcesDB = listOf(
SOURCE(
"1",
"First DB source",
"Test,second",
"spouts\\rss\\fulltextrss",
"",
"d8c92cdb1ef119ea85c4b9205c879ca7.png"
),
SOURCE(
"2",
"Second source",
"second",
"spouts\\rss\\fulltextrss",
"",
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
)
)
val (_, sourcesDB) = prepareSources()
every { appSettingsService.isItemCachingEnabled() } returns false
every { appSettingsService.isUpdateSourcesEnabled() } returns false
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
initializeRepository(MutableStateFlow(false))
var testSources: List<SelfossModel.Source>?
runBlocking {