File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/commonTest/kotlin/com.adamratzman/spotify/utilities Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2020; Original author: Adam Ratzman */
2
2
package com.adamratzman.spotify.utilities
3
3
4
+ import com.adamratzman.spotify.SpotifyException.TimeoutException
4
5
import com.adamratzman.spotify.annotations.SpotifyExperimentalHttpApi
5
6
import com.adamratzman.spotify.api
6
7
import com.adamratzman.spotify.endpoints.public.SearchApi.SearchType.TRACK
7
8
import com.adamratzman.spotify.utils.runBlocking
8
9
import org.spekframework.spek2.Spek
9
10
import org.spekframework.spek2.style.specification.describe
10
11
import kotlin.test.assertEquals
12
+ import kotlin.test.assertFailsWith
11
13
12
14
@SpotifyExperimentalHttpApi
13
15
class RestActionTests : Spek ({
@@ -21,6 +23,18 @@ class RestActionTests : Spek({
21
23
}
22
24
23
25
describe("request timeout") {
26
+ it("request timeout of 0ms (must fail)") {
27
+ val prevTimeout = api.requestTimeoutMillis
24
28
29
+ api.requestTimeoutMillis = 1
30
+
31
+ runBlocking {
32
+ assertFailsWith<TimeoutException > {
33
+ api.search.searchTrack("fail").complete()
34
+ }
35
+ }
36
+
37
+ api.requestTimeoutMillis = prevTimeout
38
+ }
25
39
}
26
40
})
You can’t perform that action at this time.
0 commit comments