Move user infos to JWT tokens #19
|
@ -14,6 +14,7 @@ import dev.fyloz.colorrecipesexplorer.utils.isAround
|
|||
import io.jsonwebtoken.Jwts
|
||||
import io.jsonwebtoken.jackson.io.JacksonDeserializer
|
||||
import io.mockk.spyk
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.time.Instant
|
||||
import kotlin.test.assertEquals
|
||||
|
@ -36,8 +37,6 @@ class JwtServiceTest {
|
|||
|
||||
private val user = user()
|
||||
private val userOutputDto = user.toOutputDto()
|
||||
private val jwt =
|
||||
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwIiwiZXhwIjoxNjM3NTA0NDYyLCJ1c2VyIjoie1wiaWRcIjowLFwiZmlyc3ROYW1lXCI6XCJmaXJzdE5hbWVcIixcImxhc3ROYW1lXCI6XCJsYXN0TmFtZVwiLFwiZ3JvdXBcIjpudWxsLFwicGVybWlzc2lvbnNcIjpbXSxcImV4cGxpY2l0UGVybWlzc2lvbnNcIjpbXSxcImxhc3RMb2dpblRpbWVcIjpudWxsfSJ9.tSU4gzkPIHldfGKwBuMg1qdQTWIA5kOzMDOBwQuj0S4"
|
||||
|
||||
// buildJwt()
|
||||
|
||||
|
@ -91,7 +90,8 @@ class JwtServiceTest {
|
|||
// parseJwt()
|
||||
|
||||
@Test
|
||||
fun `parseJwt() does things`() {
|
||||
fun `parseJwt() returns expected user`() {
|
||||
val jwt = jwtService.buildJwt(user)
|
||||
val parsedUser = jwtService.parseJwt(jwt)
|
||||
|
||||
assertEquals(userOutputDto, parsedUser)
|
||||
|
|
Loading…
Reference in New Issue