Fix sources tests
All checks were successful
continuous-integration/drone/pr Build is passing

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