Skip to content

Commit

Permalink
Test added
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaSeylani committed Oct 10, 2024
1 parent 9cffb9c commit f623b5d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions passage/src/androidTest/java/id/passage/android/TokenStoreTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest
import org.junit.After
import org.junit.Assert.assertNotSame
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
Expand Down Expand Up @@ -167,4 +168,18 @@ internal class TokenStoreTests {
assertThat(e is PassageTokenException)
}
}

@Test
fun refreshWithValidToken(): Unit =
runBlocking {
try {
val currentRefreshToken = refreshToken
val authResult = passage.tokenStore.refreshAuthToken(currentRefreshToken)
val newStoredRefreshToken = passage.tokenStore.refreshToken
assertNotNull(authResult)
assertNotSame(currentRefreshToken, newStoredRefreshToken)
} catch (e: Exception) {
assertThat(e is PassageTokenException)
}
}
}

0 comments on commit f623b5d

Please sign in to comment.