mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-12 01:30:46 +01:00
Change Playlist id type to String.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
e62e5c553c
commit
434d07c4a3
@ -29,7 +29,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() {
|
|||||||
|
|
||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().playlist) {
|
with(response.body().playlist) {
|
||||||
id `should equal to` 0
|
id `should equal to` "0"
|
||||||
name `should equal to` "Aug 27, 2017 11:17 AM"
|
name `should equal to` "Aug 27, 2017 11:17 AM"
|
||||||
owner `should equal to` "admin"
|
owner `should equal to` "admin"
|
||||||
public `should equal to` false
|
public `should equal to` false
|
||||||
|
@ -29,7 +29,7 @@ class SubsonicApiGetPlaylistsTest : SubsonicAPIClientTest() {
|
|||||||
assertResponseSuccessful(response)
|
assertResponseSuccessful(response)
|
||||||
with(response.body().playlists) {
|
with(response.body().playlists) {
|
||||||
size `should equal to` 1
|
size `should equal to` 1
|
||||||
this[0] `should equal` Playlist(id = 0, name = "Aug 27, 2017 11:17 AM",
|
this[0] `should equal` Playlist(id = "0", name = "Aug 27, 2017 11:17 AM",
|
||||||
owner = "admin", public = false, songCount = 16, duration = 3573,
|
owner = "admin", public = false, songCount = 16, duration = 3573,
|
||||||
comment = "Some comment",
|
comment = "Some comment",
|
||||||
created = parseDate("2017-08-27T11:17:26.216Z"),
|
created = parseDate("2017-08-27T11:17:26.216Z"),
|
||||||
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
|||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
data class Playlist(
|
data class Playlist(
|
||||||
val id: Long = -1,
|
val id: String = "",
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val owner: String = "",
|
val owner: String = "",
|
||||||
val comment: String = "",
|
val comment: String = "",
|
||||||
|
@ -16,7 +16,7 @@ fun APIPlaylist.toMusicDirectoryDomainEntity(): MusicDirectory = MusicDirectory(
|
|||||||
addAll(this@toMusicDirectoryDomainEntity.entriesList.map { it.toDomainEntity() })
|
addAll(this@toMusicDirectoryDomainEntity.entriesList.map { it.toDomainEntity() })
|
||||||
}
|
}
|
||||||
|
|
||||||
fun APIPlaylist.toDomainEntity(): Playlist = Playlist(this.id.toString(), this.name, this.owner,
|
fun APIPlaylist.toDomainEntity(): Playlist = Playlist(this.id, this.name, this.owner,
|
||||||
this.comment, this.songCount.toString(),
|
this.comment, this.songCount.toString(),
|
||||||
this.created?.let { playlistDateFormat.format(it.time) },
|
this.created?.let { playlistDateFormat.format(it.time) },
|
||||||
public.toString())
|
public.toString())
|
||||||
|
@ -32,7 +32,7 @@ class APIPlaylistConverterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should convert playlist to domain entity`() {
|
fun `Should convert playlist to domain entity`() {
|
||||||
val entity = Playlist(id = 634, name = "some-name", owner = "some-owner",
|
val entity = Playlist(id = "634", name = "some-name", owner = "some-owner",
|
||||||
comment = "some-comment", public = false, songCount = 256, duration = 1150,
|
comment = "some-comment", public = false, songCount = 256, duration = 1150,
|
||||||
created = Calendar.getInstance(), changed = Calendar.getInstance(),
|
created = Calendar.getInstance(), changed = Calendar.getInstance(),
|
||||||
coverArt = "some-art")
|
coverArt = "some-art")
|
||||||
@ -40,7 +40,7 @@ class APIPlaylistConverterTest {
|
|||||||
val convertedEntity = entity.toDomainEntity()
|
val convertedEntity = entity.toDomainEntity()
|
||||||
|
|
||||||
with(convertedEntity) {
|
with(convertedEntity) {
|
||||||
id `should equal to` entity.id.toString()
|
id `should equal to` entity.id
|
||||||
name `should equal to` entity.name
|
name `should equal to` entity.name
|
||||||
comment `should equal to` entity.comment
|
comment `should equal to` entity.comment
|
||||||
owner `should equal to` entity.owner
|
owner `should equal to` entity.owner
|
||||||
@ -52,7 +52,7 @@ class APIPlaylistConverterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Should convert list of playlists to list of domain entities`() {
|
fun `Should convert list of playlists to list of domain entities`() {
|
||||||
val entitiesList = listOf(Playlist(id = 23, name = "some-name", songCount = 10))
|
val entitiesList = listOf(Playlist(id = "23", name = "some-name", songCount = 10))
|
||||||
|
|
||||||
val convertedList = entitiesList.toDomainEntitiesList()
|
val convertedList = entitiesList.toDomainEntitiesList()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user