Skip to content

Native Android client for Spotify, built with Jetpack Compose

A live test reads the What's New feed and checks that every entry is an album or an episode, for both pills

andreiP4083ffe4ba531
diff --git a/base/host-cdp/src/test/kotlin/app/myspoti/host/cdp/LiveDomainsTest.kt b/base/host-cdp/src/test/kotlin/app/myspoti/host/cdp/LiveDomainsTest.kt
index 0d56c8ab..19faabe5 100644
--- a/base/host-cdp/src/test/kotlin/app/myspoti/host/cdp/LiveDomainsTest.kt
+++ b/base/host-cdp/src/test/kotlin/app/myspoti/host/cdp/LiveDomainsTest.kt
@@ -6,6 +6,7 @@ import app.myspoti.api.LibraryFilter
import app.myspoti.api.LibrarySort
import app.myspoti.api.MediaKind
import app.myspoti.api.TimeRange
+import app.myspoti.api.WhatsNewContent
import app.myspoti.spotify.SpotifyApi
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -77,6 +78,16 @@ class LiveDomainsTest {
assertTrue(page.title.isNotBlank() && page.shelves.isNotEmpty())
}
+ // Reads only: the entries' seen state is left as it was (no markWhatsNewSeen).
+ @Test
+ fun `what's new feed holds albums and episodes, per pill`() = live {
+ val all = api.home.whatsNewFeed(0, 20)
+ assertTrue(all.items.all { it.id.isNotBlank() && (it.album != null) != (it.episode != null) })
+ assertTrue(all.items.all { it.uri.startsWith("spotify:album:") || it.uri.startsWith("spotify:episode:") })
+ assertTrue(api.home.whatsNewFeed(0, 20, WhatsNewContent.MUSIC).items.all { it.album != null })
+ assertTrue(api.home.whatsNewFeed(0, 20, WhatsNewContent.PODCASTS).items.all { it.episode != null })
+ }
+
@Test
fun `search every tab and recent searches`() = live {
assertTrue(api.search.shows("france inter").items.first().kind == MediaKind.SHOW)