mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-15 14:56:43 +03:00
Add method to convert list of Albums to MusicDirectory Entry list.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
14fac18978
commit
bb95d04dc5
@ -23,3 +23,5 @@ fun Album.toDomainEntity(): MusicDirectory.Entry = MusicDirectory.Entry().apply
|
||||
fun Album.toMusicDirectoryDomainEntity(): MusicDirectory = MusicDirectory().apply {
|
||||
addAll(this@toMusicDirectoryDomainEntity.songList.map { it.toDomainEntity() })
|
||||
}
|
||||
|
||||
fun List<Album>.toDomainEntityList(): List<MusicDirectory.Entry> = this.map { it.toDomainEntity() }
|
||||
|
@ -51,4 +51,18 @@ class APIAlbumConverterTest {
|
||||
children[0] `should equal` entity.songList[0].toDomainEntity()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should convert list of Album entities to domain list entities`() {
|
||||
val entityList = listOf(Album(id = 455), Album(id = 1), Album(id = 1000))
|
||||
|
||||
val convertedList = entityList.toDomainEntityList()
|
||||
|
||||
with(convertedList) {
|
||||
size `should equal to` entityList.size
|
||||
forEachIndexed { index, entry ->
|
||||
entry `should equal` entityList[index].toDomainEntity()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user