File tree 2 files changed +16
-0
lines changed
androidTest/java/id/passage/android
main/java/id/passage/android
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import kotlinx.coroutines.delay
17
17
import kotlinx.coroutines.runBlocking
18
18
import kotlinx.coroutines.test.runTest
19
19
import org.junit.After
20
+ import org.junit.Assert.assertNotSame
20
21
import org.junit.Assert.assertTrue
21
22
import org.junit.Before
22
23
import org.junit.Rule
@@ -167,4 +168,18 @@ internal class TokenStoreTests {
167
168
assertThat(e is PassageTokenException )
168
169
}
169
170
}
171
+
172
+ @Test
173
+ fun refreshWithValidToken (): Unit =
174
+ runBlocking {
175
+ try {
176
+ val currentRefreshToken = refreshToken
177
+ val authResult = passage.tokenStore.refreshAuthToken(currentRefreshToken)
178
+ val newStoredRefreshToken = passage.tokenStore.refreshToken
179
+ assertNotNull(authResult)
180
+ assertNotSame(currentRefreshToken, newStoredRefreshToken)
181
+ } catch (e: Exception ) {
182
+ assertThat(e is PassageTokenException )
183
+ }
184
+ }
170
185
}
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ class PassageTokenStore(
93
93
} catch (e: Exception ) {
94
94
throw PassageTokenException .convert(e)
95
95
}
96
+ setTokens(apiAuthResult)
96
97
return apiAuthResult
97
98
}
98
99
You can’t perform that action at this time.
0 commit comments