Skip to content

Commit

Permalink
✅ Fix Test Fail by fixture monkey
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW committed Dec 1, 2024
1 parent 6f99e72 commit d25c651
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import com.threedays.domain.support.common.ClientOS
import com.threedays.domain.user.entity.User
import com.threedays.domain.user.entity.UserDesiredPartner
import com.threedays.domain.user.entity.UserProfile
import com.threedays.domain.user.entity.UserProfileImage
import com.threedays.domain.user.repository.UserRepositorySpy
import com.threedays.support.common.security.jwt.JwtTokenProvider
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.annotation.DisplayName
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
import java.net.URL
import java.time.LocalDateTime

@DisplayName("[서비스][인증] - AuthCode(인증 코드)")
Expand Down Expand Up @@ -93,11 +95,20 @@ class AuthCodeServiceTest : DescribeSpec({
.set(UserDesiredPartner::allowSameCompany, null)
.sample()


val userProfileImageUrl: URL = URL("http://example.com")
val userProfileImage = fixtureMonkey
.giveMeBuilder<UserProfileImage>()
.set(UserProfileImage::url, userProfileImageUrl)
.sampleList(1)


fixtureMonkey
.giveMeBuilder<User>()
.set(User::name, User.Name("홍길동"))
.set(User::phoneNumber, phoneNumber)
.set(User::profile, userProfile)
.set(User::profileImages, userProfileImage)
.set(User::desiredPartner, userDesiredPartner)
.sample()
.also { userRepository.save(it) }
Expand Down Expand Up @@ -177,10 +188,17 @@ class AuthCodeServiceTest : DescribeSpec({
.set(UserDesiredPartner::allowSameCompany, null)
.sample()

val userProfileImageUrl: URL = URL("http://example.com")
val userProfileImage = fixtureMonkey
.giveMeBuilder<UserProfileImage>()
.set(UserProfileImage::url, userProfileImageUrl)
.sampleList(1)

fixtureMonkey
.giveMeBuilder<User>()
.set(User::name, User.Name("홍길동"))
.set(User::phoneNumber, phoneNumber)
.set(User::profileImages, userProfileImage)
.set(User::profile, userProfile)
.set(User::desiredPartner, userDesiredPartner)
.sample()
Expand Down Expand Up @@ -291,11 +309,19 @@ class AuthCodeServiceTest : DescribeSpec({
.set(UserDesiredPartner::allowSameCompany, null)
.sample()


val userProfileImageUrl: URL = URL("http://example.com")
val userProfileImage = fixtureMonkey
.giveMeBuilder<UserProfileImage>()
.set(UserProfileImage::url, userProfileImageUrl)
.sampleList(1)

fixtureMonkey
.giveMeBuilder<User>()
.set(User::name, User.Name("홍길동"))
.set(User::phoneNumber, phoneNumber)
.set(User::profile, userProfile)
.set(User::profileImages, userProfileImage)
.set(User::desiredPartner, userDesiredPartner)
.sample()
.also { userRepository.save(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import com.threedays.domain.auth.vo.PhoneNumber
import com.threedays.domain.user.entity.User
import com.threedays.domain.user.entity.UserDesiredPartner
import com.threedays.domain.user.entity.UserProfile
import com.threedays.domain.user.entity.UserProfileImage
import com.threedays.support.common.base.domain.UUIDTypeId
import com.threedays.support.common.security.jwt.JwtTokenProvider
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.annotation.DisplayName
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
import java.net.URL

@DisplayName("[서비스][인증] - AuthToken(인증 토큰)")
class AuthTokenServiceTest : DescribeSpec({
Expand Down Expand Up @@ -64,11 +66,20 @@ class AuthTokenServiceTest : DescribeSpec({
.set(UserDesiredPartner::allowSameCompany, null)
.sample()


val userProfileImageUrl: URL = URL("http://example.com")
val userProfileImage = fixtureMonkey
.giveMeBuilder<UserProfileImage>()
.set(UserProfileImage::url, userProfileImageUrl)
.sampleList(1)


val user = fixtureMonkey
.giveMeBuilder<User>()
.set(User::name, User.Name("홍길동"))
.set(User::id, userId)
.set(User::profile, userProfile)
.set(User::profileImages, userProfileImage)
.set(User::desiredPartner, userDesiredPartner)
.set(User::phoneNumber, PhoneNumber("01012345678"))
.sample()
Expand Down

0 comments on commit d25c651

Please sign in to comment.