Skip to content

Commit b8d42db

Browse files
committed
fix new endpoint behavior
1 parent 2892164 commit b8d42db

File tree

3 files changed

+8
-66
lines changed

3 files changed

+8
-66
lines changed

src/commonMain/kotlin/com.adamratzman.spotify/endpoints/pub/ShowApi.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public open class ShowApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
6363
* Note: If neither market or user country are provided, the content is considered unavailable for the client.
6464
* Users can view the country that is associated with their account in the account settings. Required for [SpotifyAppApi], but **you may use [Market.FROM_TOKEN] to get the user market**
6565
*
66-
* @return List of possibly-null [SimpleShow] objects.
67-
* @throws BadRequestException If any invalid show id is provided
66+
* @return List of possibly-null [SimpleShow] objects, if the show was not found or invalid ids were provided.
6867
*/
6968
public suspend fun getShows(vararg ids: String, market: Market): List<SimpleShow?> {
7069
checkBulkRequesting(50, ids.size)

src/commonTest/kotlin/com.adamratzman/spotify/priv/ShowApiTest.kt

-55
This file was deleted.

src/commonTest/kotlin/com.adamratzman/spotify/pub/ShowApiTest.kt

+7-9
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import com.adamratzman.spotify.runTestOnDefaultDispatcher
1010
import com.adamratzman.spotify.utils.Market
1111
import kotlinx.coroutines.ExperimentalCoroutinesApi
1212
import kotlinx.coroutines.test.TestResult
13-
import kotlin.test.Test
14-
import kotlin.test.assertEquals
15-
import kotlin.test.assertFailsWith
16-
import kotlin.test.assertNull
13+
import kotlin.test.*
1714

1815
class ShowApiTest : AbstractTest<GenericSpotifyApi>() {
1916
private val market = Market.US
@@ -33,11 +30,12 @@ class ShowApiTest : AbstractTest<GenericSpotifyApi>() {
3330
fun testGetShows(): TestResult = runTestOnDefaultDispatcher {
3431
buildApi(::testGetShows.name)
3532

36-
assertFailsWith<BadRequestException> { api.shows.getShows("hi", "dad", market = market) }
37-
assertFailsWith<BadRequestException> {
38-
api.shows.getShows("78nWZk9ikQrOJX7OTRE2h7", "j", market = market).map { it?.name }
39-
}
40-
assertEquals(
33+
assertContentEquals(listOf(null, null), api.shows.getShows("hi", "dad", market = market))
34+
assertContentEquals(
35+
listOf(null, null),
36+
api.shows.getShows("78sdfjsdjfsjdf", "j", market = market).map { it?.id }
37+
)
38+
assertContentEquals(
4139
listOf("Freakonomics Radio"),
4240
api.shows.getShows("6z4NLXyHPga1UmSJsPK7G1", market = market).map { it?.name }
4341
)

0 commit comments

Comments
 (0)