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].
*/
class APIIndexConverterTest {
class APIIndexConverterTest : BaseTest() {
@Test
fun `Should convert Indexes entity`() {
val artistsA = listOf(
@ -31,9 +31,12 @@ class APIIndexConverterTest {
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) {
size `should be equal to` expectedArtists.size
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.
*/
class APIShareConverterTest {
class APIShareConverterTest : BaseTest() {
@Test
fun `Should convert share entity to domain`() {
val entity = createFakeShare()
val domainEntity = entity.toDomainEntity()
val domainEntity = entity.toDomainEntity(serverId)
with(domainEntity) {
id `should be equal to` entity.id
@ -27,7 +27,7 @@ class APIShareConverterTest {
lastVisited `should be equal to` shareTimeFormat.format(entity.lastVisited!!.time)
expires `should be equal to` shareTimeFormat.format(entity.expires!!.time)
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)
)
val domainEntityList = entityList.toDomainEntitiesList()
val domainEntityList = entityList.toDomainEntitiesList(serverId)
domainEntityList.size `should be equal to` entityList.size
domainEntityList[0] `should be equal to` entityList[0].toDomainEntity()
domainEntityList[1] `should be equal to` entityList[1].toDomainEntity()
domainEntityList[0] `should be equal to` entityList[0].toDomainEntity(serverId)
domainEntityList[1] `should be equal to` entityList[1].toDomainEntity(serverId)
}
}