File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
src/commonJvmLikeTest/kotlin/com/adamratzman/spotify Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,13 @@ jobs:
2929 java-version : ' 11'
3030 - name : Install curl
3131 run : sudo apt-get install -y curl libcurl4-openssl-dev
32- - name : Test secret
33- run : echo "client id secret is $SPOTIFY_CLIENT_ID"
3432 - name : Test android
3533 run : ./gradlew testDebugUnitTest
3634 - name : Test jvm
3735 run : ./gradlew jvmTest
3836 - name : Archive test results
3937 uses : actions/upload-artifact@v2
38+ if : always()
4039 with :
4140 name : code-coverage-report
4241 path : build/reports
@@ -63,14 +62,13 @@ jobs:
6362 java-version : ' 11'
6463 - name : Install curl
6564 run : sudo apt-get install -y curl libcurl4-openssl-dev
66- - name : Test secret
67- run : echo "client id secret is $SPOTIFY_CLIENT_ID"
6865 - name : Test android
6966 run : ./gradlew testDebugUnitTest
7067 - name : Test jvm
7168 run : ./gradlew jvmTest
7269 - name : Archive test results
7370 uses : actions/upload-artifact@v2
71+ if : always()
7472 with :
7573 name : code-coverage-report
7674 path : build/reports
Original file line number Diff line number Diff line change @@ -18,7 +18,19 @@ actual fun isHttpLoggingEnabled(): Boolean = System.getenv("SPOTIFY_LOG_HTTP") =
1818actual fun arePlayerTestsEnabled (): Boolean = System .getenv(" SPOTIFY_ENABLE_PLAYER_TESTS" )?.toBoolean() == true
1919actual fun areLivePkceTestsEnabled (): Boolean = System .getenv(" VERBOSE_TEST_ENABLED" )?.toBoolean() ? : false
2020
21+ var hasInstantiatedApi: Boolean = false
22+ var backingApi: GenericSpotifyApi ? = null
23+
2124actual suspend fun buildSpotifyApi (testClassQualifiedName : String , testName : String ): GenericSpotifyApi ? {
25+ if (! hasInstantiatedApi) {
26+ backingApi = buildSpotifyApiInternal()
27+ hasInstantiatedApi = true
28+ }
29+
30+ return backingApi;
31+ }
32+
33+ private suspend fun buildSpotifyApiInternal (): GenericSpotifyApi ? {
2234 val clientId = getTestClientId()
2335 val clientSecret = getTestClientSecret()
2436 val tokenString = getTestTokenString()
You can’t perform that action at this time.
0 commit comments