From efb71482151ece7ecde5fb5849fc390cb83d7d67 Mon Sep 17 00:00:00 2001 From: pricelees Date: Thu, 18 Sep 2025 15:29:07 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Fixture=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20Unique=20=EC=A0=9C?= =?UTF-8?q?=EC=95=BD=20=EC=A1=B0=EA=B1=B4=20=ED=95=B4=EA=B2=B0=20=EB=B0=8F?= =?UTF-8?q?=20=EC=9D=BC=EB=B6=80=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/roomescape/supports/Fixtures.kt | 72 +++++++++++++++---- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/src/test/kotlin/roomescape/supports/Fixtures.kt b/src/test/kotlin/roomescape/supports/Fixtures.kt index a4b62fea..6c728d31 100644 --- a/src/test/kotlin/roomescape/supports/Fixtures.kt +++ b/src/test/kotlin/roomescape/supports/Fixtures.kt @@ -10,10 +10,13 @@ import roomescape.payment.infrastructure.common.* import roomescape.payment.web.PaymentCancelRequest import roomescape.payment.web.PaymentConfirmRequest import roomescape.reservation.web.PendingReservationCreateRequest +import roomescape.schedule.infrastructure.persistence.ScheduleEntity +import roomescape.schedule.infrastructure.persistence.ScheduleEntityFactory import roomescape.schedule.web.ScheduleCreateRequest import roomescape.store.infrastructure.persistence.StoreEntity import roomescape.store.infrastructure.persistence.StoreStatus import roomescape.theme.infrastructure.persistence.Difficulty +import roomescape.theme.infrastructure.persistence.ThemeEntity import roomescape.theme.web.ThemeCreateRequest import roomescape.user.infrastructure.persistence.UserEntity import roomescape.user.infrastructure.persistence.UserStatus @@ -26,11 +29,10 @@ import java.time.OffsetDateTime const val INVALID_PK: Long = 9999L val tsidFactory = TsidFactory(0) - object StoreFixture { fun create( id: Long = tsidFactory.next(), - name: String = "테스트-${randomString()}점", + name: String = "행복${randomPhoneNumber()}호점", address: String = "서울특별시 강북구 행복길 123", contact: String = randomPhoneNumber(), businessRegNum: String = randomBusinessRegNum(), @@ -110,16 +112,20 @@ object AdminFixture { type: AdminType = AdminType.STORE, storeId: Long? = tsidFactory.next(), permissionLevel: AdminPermissionLevel = AdminPermissionLevel.FULL_ACCESS - ): AdminEntity = AdminEntity( - id = id, - account = account, - password = password, - name = name, - phone = phone, - type = type, - storeId = storeId, - permissionLevel = permissionLevel, - ) + ): AdminEntity { + val storeId = if (type == AdminType.HQ) null else storeId + + return AdminEntity( + id = id, + account = account, + password = password, + name = name, + phone = phone, + type = type, + storeId = storeId, + permissionLevel = permissionLevel, + ) + } } object UserFixture { @@ -169,6 +175,34 @@ object ThemeFixture { expectedMinutesTo = 70, isActive = true ) + + fun create( + id: Long = tsidFactory.next(), + name: String = randomString(), + description: String = randomString(), + thumbnailUrl: String = "http://www.bing.com/search?q=fugit", + difficulty: Difficulty = Difficulty.VERY_EASY, + price: Int = 10_000, + minParticipants: Short = 3, + maxParticipants: Short = 5, + availableMinutes: Short = 60, + expectedMinutesFrom: Short = 40, + expectedMinutesTo: Short = 50, + isActive: Boolean = true + ) = ThemeEntity( + id = id, + name = name, + description = description, + thumbnailUrl = thumbnailUrl, + difficulty = difficulty, + price = price, + minParticipants = minParticipants, + maxParticipants = maxParticipants, + availableMinutes = availableMinutes, + expectedMinutesFrom = expectedMinutesFrom, + expectedMinutesTo = expectedMinutesTo, + isActive = isActive + ) } object ScheduleFixture { @@ -177,6 +211,20 @@ object ScheduleFixture { time = LocalTime.now(), themeId = tsidFactory.next() ) + + fun create( + id: Long = tsidFactory.next(), + date: LocalDate = LocalDate.now().plusDays(1), + time: LocalTime = LocalTime.now(), + storeId: Long = tsidFactory.next(), + themeId: Long = tsidFactory.next() + ): ScheduleEntity = ScheduleEntityFactory.create( + id = id, + date = date, + time = time, + storeId = storeId, + themeId = themeId + ) } object PaymentFixture {