Fix two tests.

This commit is contained in:
tzugen 2022-07-05 15:44:34 +02:00
parent 53a1a5545a
commit 152b1d261a
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 12 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import org.moire.ultrasonic.api.subsonic.models.Indexes
/** /**
* Unit tests for extension functions in [APIIndexesConverter.kt]. * Unit tests for extension functions in [APIIndexesConverter.kt].
*/ */
class APIIndexConverterTest { class APIIndexConverterTest : BaseTest() {
@Test @Test
fun `Should convert Indexes entity`() { fun `Should convert Indexes entity`() {
val artistsA = listOf( val artistsA = listOf(
@ -31,9 +31,12 @@ class APIIndexConverterTest {
shortcutList = artistsA shortcutList = artistsA
) )
val convertedEntity = entity.toArtistList() val convertedEntity = entity.toArtistList(serverId)
val expectedArtists = (artistsA + artistsT).map {
it.toDomainEntity(serverId)
}.toMutableList()
val expectedArtists = (artistsA + artistsT).map { it.toDomainEntity() }.toMutableList()
with(convertedEntity) { with(convertedEntity) {
size `should be equal to` expectedArtists.size size `should be equal to` expectedArtists.size
this `should be equal to` expectedArtists this `should be equal to` expectedArtists

View File

@ -11,12 +11,12 @@ import org.moire.ultrasonic.api.subsonic.models.Share
/** /**
* Unit test for api to domain share entity converter functions. * Unit test for api to domain share entity converter functions.
*/ */
class APIShareConverterTest { class APIShareConverterTest : BaseTest() {
@Test @Test
fun `Should convert share entity to domain`() { fun `Should convert share entity to domain`() {
val entity = createFakeShare() val entity = createFakeShare()
val domainEntity = entity.toDomainEntity() val domainEntity = entity.toDomainEntity(serverId)
with(domainEntity) { with(domainEntity) {
id `should be equal to` entity.id id `should be equal to` entity.id
@ -27,7 +27,7 @@ class APIShareConverterTest {
lastVisited `should be equal to` shareTimeFormat.format(entity.lastVisited!!.time) lastVisited `should be equal to` shareTimeFormat.format(entity.lastVisited!!.time)
expires `should be equal to` shareTimeFormat.format(entity.expires!!.time) expires `should be equal to` shareTimeFormat.format(entity.expires!!.time)
visitCount `should be equal to` entity.visitCount.toLong() visitCount `should be equal to` entity.visitCount.toLong()
this.getEntries() `should be equal to` entity.items.toDomainEntityList() this.getEntries() `should be equal to` entity.items.toDomainEntityList(serverId)
} }
} }
@ -47,10 +47,10 @@ class APIShareConverterTest {
createFakeShare().copy(id = "554", lastVisited = null) createFakeShare().copy(id = "554", lastVisited = null)
) )
val domainEntityList = entityList.toDomainEntitiesList() val domainEntityList = entityList.toDomainEntitiesList(serverId)
domainEntityList.size `should be equal to` entityList.size domainEntityList.size `should be equal to` entityList.size
domainEntityList[0] `should be equal to` entityList[0].toDomainEntity() domainEntityList[0] `should be equal to` entityList[0].toDomainEntity(serverId)
domainEntityList[1] `should be equal to` entityList[1].toDomainEntity() domainEntityList[1] `should be equal to` entityList[1].toDomainEntity(serverId)
} }
} }