mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
home: add an On repeat song row and move recently starred below genres
This commit is contained in:
@@ -335,6 +335,24 @@ class LibraryHomeDaoTest {
|
||||
assertEquals(displayed, dao.starredSongIds(sourceId))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRepeatKeepsSongsPlayedThisWeekAndOrdersByPlayCount() =
|
||||
runTest {
|
||||
val sourceId = source()
|
||||
val dao = db.libraryDao()
|
||||
dao.upsertSongs(
|
||||
listOf(
|
||||
song(sourceId, "s1", "One", playCount = 3, played = 900),
|
||||
song(sourceId, "s2", "Two", playCount = 9, played = 950),
|
||||
song(sourceId, "s3", "Three", playCount = 100, played = 100),
|
||||
),
|
||||
)
|
||||
|
||||
val onRepeat = dao.onRepeatSongs(sourceId, cutoff = 500, limit = 5).first()
|
||||
assertEquals(listOf("s2", "s1"), onRepeat.map { it.song.id })
|
||||
assertEquals(listOf("s2", "s1"), dao.onRepeatSongIds(sourceId, cutoff = 500))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun songsByGenrePagingFiltersAndJoinsAlbumCoverArt() =
|
||||
runTest {
|
||||
|
||||
@@ -131,6 +131,7 @@ class HomeScreenshotTest {
|
||||
genres = listOf("Rock", "Jazz", "Classical", "Electronic", "Pop", "Folk", "Blues"),
|
||||
decades = listOf(1960L, 1970L, 1980L, 1990L, 2000L, 2010L),
|
||||
recentlyStarredSongs = songs(),
|
||||
onRepeatSongs = songs(),
|
||||
recentlyAddedAlbums = albums("Added"),
|
||||
rediscoverAlbums = albums("Repeat"),
|
||||
)
|
||||
|
||||
@@ -26,6 +26,7 @@ class HomeViewModelTest {
|
||||
addedAlbums = listOf(album("c")),
|
||||
rediscover = listOf(album("d")),
|
||||
hasPlayData = true,
|
||||
onRepeatSongs = listOf(starred("repeat")),
|
||||
)
|
||||
|
||||
assertEquals(listOf("a"), feed.recentlyPlayedAlbums.map { it.id })
|
||||
@@ -35,6 +36,7 @@ class HomeViewModelTest {
|
||||
assertEquals(listOf("Rock"), feed.genres)
|
||||
assertEquals(listOf(1970L), feed.decades)
|
||||
assertEquals(listOf("song"), feed.recentlyStarredSongs.map { it.song.id })
|
||||
assertEquals(listOf("repeat"), feed.onRepeatSongs.map { it.song.id })
|
||||
assertEquals(listOf("c"), feed.recentlyAddedAlbums.map { it.id })
|
||||
assertEquals(listOf("d"), feed.rediscoverAlbums.map { it.id })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user