Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
[WEAV-154] 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW committed Feb 2, 2024
1 parent fabcf1d commit 101f5a7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.studentcenter.weave.application.user.port.inbound

fun interface UserRefreshTokenUseCase {

fun invoke(command: com.studentcenter.weave.application.user.port.inbound.UserRefreshTokenUseCase.Command): com.studentcenter.weave.application.user.port.inbound.UserRefreshTokenUseCase.Result
fun invoke(command: Command): Result

data class Command(
val refreshToken: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.*

fun interface UserRegisterUseCase {

fun invoke(command: com.studentcenter.weave.application.user.port.inbound.UserRegisterUseCase.Command): com.studentcenter.weave.application.user.port.inbound.UserRegisterUseCase.Result
fun invoke(command: Command): Result

data class Command(
val nickname: Nickname,
Expand All @@ -28,7 +28,7 @@ fun interface UserRegisterUseCase {
data class Success(
val accessToken: String,
val refreshToken: String,
) : com.studentcenter.weave.application.user.port.inbound.UserRegisterUseCase.Result()
) : Result()

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.studentcenter.weave.domain.user.enums.SocialLoginProvider

fun interface UserSocialLoginUseCase {

fun invoke(command: com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Command): com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result
fun invoke(command: Command): Result

data class Command(
val socialLoginProvider: SocialLoginProvider,
Expand All @@ -16,11 +16,11 @@ fun interface UserSocialLoginUseCase {
data class Success(
val accessToken: String,
val refreshToken: String,
) : com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result()
) : Result()

data class NotRegistered(
val registerToken: String,
) : com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result()
) : Result()

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.studentcenter.weave.application.user.service.application

import com.studentcenter.weave.application.common.properties.JwtTokenPropertiesFixtureFactory
import com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase
import com.studentcenter.weave.application.user.port.outbound.UserAuthInfoRepositorySpy
import com.studentcenter.weave.application.user.port.outbound.UserRefreshTokenRepositorySpy
import com.studentcenter.weave.application.user.port.outbound.UserRepositorySpy
Expand Down Expand Up @@ -46,18 +47,16 @@ class UserSocialLoginApplicationServiceTest : DescribeSpec({
.let { userAuthInfoRepositorySpy.save(it) }

val idToken = "idToken"
val command =
com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Command(
socialLoginProvider = socialLoginProvider,
idToken = idToken,
)
val command = UserSocialLoginUseCase.Command(
socialLoginProvider = socialLoginProvider,
idToken = idToken,
)

// act
val result: com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result =
sut.invoke(command)
val result: UserSocialLoginUseCase.Result = sut.invoke(command)

// assert
result.shouldBeTypeOf<com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result.Success>()
result.shouldBeTypeOf<UserSocialLoginUseCase.Result.Success>()
result.accessToken.shouldBeTypeOf<String>()
result.refreshToken.shouldBeTypeOf<String>()
}
Expand All @@ -70,17 +69,17 @@ class UserSocialLoginApplicationServiceTest : DescribeSpec({
// arrange
val idToken = "idToken"
val command =
com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Command(
UserSocialLoginUseCase.Command(
socialLoginProvider = socialLoginProvider,
idToken = idToken,
)

// act
val result: com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result =
val result: UserSocialLoginUseCase.Result =
sut.invoke(command)

// assert
result.shouldBeTypeOf<com.studentcenter.weave.application.user.port.inbound.UserSocialLoginUseCase.Result.NotRegistered>()
result.shouldBeTypeOf<UserSocialLoginUseCase.Result.NotRegistered>()
result.registerToken.shouldBeTypeOf<String>()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.studentcenter.weave.domain.user.entity.User
import java.util.*
import java.util.concurrent.ConcurrentHashMap

class UserRepositorySpy : com.studentcenter.weave.application.user.port.outbound.UserRepository {
class UserRepositorySpy : UserRepository {

private val bucket = ConcurrentHashMap<UUID, User>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component
@Component
class UserAuthInfoJpaAdapter(
private val userAuthInfoJpaRepository: UserAuthInfoJpaRepository
) : com.studentcenter.weave.application.user.port.outbound.UserAuthInfoRepository {
) : UserAuthInfoRepository {

override fun findByEmail(email: Email): UserAuthInfo? {
return userAuthInfoJpaRepository.findByEmail(email)?.toDomain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.util.*
@Component
class UserJpaAdapter(
private val userJpaRepository: UserJpaRepository
) : com.studentcenter.weave.application.user.port.outbound.UserRepository {
) : UserRepository {

override fun save(user: User) {
val userJpaEntity: UserJpaEntity = user.toJpaEntity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.*
@Component
class UserRefreshTokenRedisAdapter(
private val userRefreshTokenRedisRepository: UserRefreshTokenRedisRepository
) : com.studentcenter.weave.application.user.port.outbound.UserRefreshTokenRepository {
) : UserRefreshTokenRepository {

override fun save(
userId: UUID,
Expand Down

0 comments on commit 101f5a7

Please sign in to comment.