mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
library: keep display-only artists out of the artist lists
Filter the paged, search and home artist lists to artists referenced by the plural credits, falling back to the full list while the relation tables are still empty. Display names keep using the singular tag and navigation keeps using the plural refs.
This commit is contained in:
@@ -27,6 +27,7 @@ import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -58,7 +59,7 @@ class SyncServiceTest {
|
||||
FakeMusicSource(
|
||||
artists = listOf(artist("a1"), artist("a2")),
|
||||
albums = listOf(album("al1")),
|
||||
songs = listOf(song("s1"), song("s2")),
|
||||
songs = listOf(song("s1"), song("s2").copy(artistId = "a2")),
|
||||
playlists = listOf(playlist("p1")),
|
||||
playlistSongs = listOf(PlaylistSong(1, "p1", "s1", 0)),
|
||||
)
|
||||
@@ -1064,6 +1065,37 @@ class SyncServiceTest {
|
||||
assertEquals("Zulu", db.libraryDao().songOnce(1, "s1")!!.artistSort)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theArtistsListHidesNamesThatAreOnlyDisplayStrings() =
|
||||
runTest {
|
||||
insertSource()
|
||||
val source =
|
||||
FakeMusicSource(
|
||||
artists = listOf(artist("a1", "Alpha"), artist("combo", "Alpha & Beta")),
|
||||
albums = listOf(album("al1")),
|
||||
songs = listOf(song("s1")),
|
||||
)
|
||||
|
||||
SyncService(db, source).sync()
|
||||
|
||||
assertEquals(
|
||||
listOf("a1"),
|
||||
db
|
||||
.libraryDao()
|
||||
.artistsByName(1, 0, "")
|
||||
.allRows()
|
||||
.map { it.id },
|
||||
)
|
||||
assertEquals(
|
||||
listOf("a1"),
|
||||
db
|
||||
.libraryDao()
|
||||
.searchArtists(1, "alpha", 10)
|
||||
.first()
|
||||
.map { it.id },
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun everyAlbumArtistAndTrackArtistReachesTheSharedAlbum() =
|
||||
runTest {
|
||||
|
||||
Reference in New Issue
Block a user