Fix sources tests

This commit is contained in:
davidoskky 2023-03-12 17:26:28 +01:00
parent 0c942f7a80
commit 4966fb704e

View File

@ -300,10 +300,10 @@ class RepositoryTest {
every { appSettingsService.isItemCachingEnabled() } returns true
initializeRepository(MutableStateFlow(false))
repository.setSourceFilter(SelfossModel.Source(
repository.setSourceFilter(SelfossModel.SourceDetail(
1,
"Test",
0,
null,
listOf("tags"),
SPOUT,
"",
@ -615,7 +615,7 @@ class RepositoryTest {
testSources = repository.getSourcesDetails()
}
assertEquals(sources.map { SelfossModel.Source(it) }, testSources)
assertEquals(sources, testSources)
assertNotEquals(sourcesDB.map { it.toView() }, testSources)
coVerify(exactly = 1) { api.sourcesDetailed() }
}
@ -625,6 +625,7 @@ class RepositoryTest {
SelfossModel.SourceDetail(
1,
"First source",
null,
listOf("Test", "second"),
SPOUT,
"",
@ -634,6 +635,7 @@ class RepositoryTest {
SelfossModel.SourceDetail(
2,
"Second source",
null,
listOf("second"),
SPOUT,
"",
@ -645,7 +647,6 @@ class RepositoryTest {
SOURCE(
"1",
"First DB source",
3,
"Test,second",
SPOUT,
"",
@ -655,7 +656,6 @@ class RepositoryTest {
SOURCE(
"2",
"Second source",
null,
"second",
SPOUT,
"",
@ -684,7 +684,7 @@ class RepositoryTest {
}
coVerify(exactly = 1) { api.sourcesDetailed() }
assertNotEquals(sources.map { SelfossModel.Source(it) }, testSources)
assertNotEquals(sources, testSources)
assertEquals(sourcesDB.map { it.toView() }, testSources)
verify(atLeast = 1) { db.sourcesQueries.sources().executeAsList() }
}
@ -701,7 +701,7 @@ class RepositoryTest {
testSources = repository.getSourcesDetails()
}
assertEquals(sources.map { SelfossModel.Source(it) }, testSources)
assertEquals(sources, testSources)
coVerify(exactly = 1) { api.sourcesDetailed() }
verify(exactly = 0) { db.sourcesQueries }
}
@ -718,7 +718,7 @@ class RepositoryTest {
testSources = repository.getSourcesDetails()
}
assertEquals(sources.map { SelfossModel.Source(it) }, testSources)
assertEquals(sources, testSources)
coVerify(exactly = 1) { api.sourcesDetailed() }
verify(atLeast = 1) { db.sourcesQueries }
}
@ -1105,7 +1105,7 @@ class RepositoryTest {
private fun prepareSearch() {
repository.setTagFilter(SelfossModel.Tag("Tag", "read", 0))
repository.setSourceFilter(
SelfossModel.Source(
SelfossModel.SourceDetail(
1,
"First source",
5,