feat(gift): 받은 선물 상세 표시를 추가한다
This commit is contained in:
@@ -19,7 +19,10 @@ sealed interface GiftDetailText {
|
||||
CANCELED_LABEL,
|
||||
CANCELED_TITLE,
|
||||
CANCELED_BODY,
|
||||
DISPOSAL_NON_RETURN_GUIDANCE
|
||||
DISPOSAL_NON_RETURN_GUIDANCE,
|
||||
RECIPIENT_ADDRESS_COMPLETED_TITLE,
|
||||
RECIPIENT_DELIVERED_TITLE,
|
||||
RECIPIENT_ADDRESS_REMOVAL_GUIDANCE
|
||||
}
|
||||
|
||||
data class Raw(val value: String) : GiftDetailText
|
||||
@@ -41,7 +44,8 @@ data class GiftDetailUiModel(
|
||||
val recipientAddress: GiftDetailAddress?,
|
||||
val undeliverable: GiftDetailUndeliverable?,
|
||||
val cancellation: GiftDetailCancellation?,
|
||||
val actions: Set<GiftDetailAction>
|
||||
val actions: Set<GiftDetailAction>,
|
||||
val received: GiftDetailReceived?
|
||||
)
|
||||
|
||||
data class GiftDetailHero(val chip: GiftDetailText?, val title: GiftDetailText, val body: GiftDetailText?)
|
||||
@@ -70,4 +74,54 @@ data class GiftDetailUndeliverable(val title: GiftDetailText, val guidance: Gift
|
||||
|
||||
data class GiftDetailCancellation(val date: String?, val refundCan: Int?)
|
||||
|
||||
enum class GiftDetailAction { TRACKING, CANCEL, INQUIRY }
|
||||
sealed interface GiftDetailReceived {
|
||||
data class AddressForm(
|
||||
val pendingGiftRows: List<GiftDetailInfoRow>,
|
||||
val addressForm: GiftDetailAddressForm
|
||||
) : GiftDetailReceived
|
||||
|
||||
data class AddressCompleted(
|
||||
val hero: GiftDetailHero,
|
||||
val giftInfoRows: List<GiftDetailInfoRow>,
|
||||
val recipientAddress: GiftDetailAddress?
|
||||
) : GiftDetailReceived
|
||||
|
||||
data class Delivered(
|
||||
val hero: GiftDetailHero,
|
||||
val giftInfoRows: List<GiftDetailInfoRow>,
|
||||
val recipientAddress: GiftDetailAddress?,
|
||||
val recipientAddressGuidance: GiftDetailText?
|
||||
) : GiftDetailReceived
|
||||
|
||||
data class Undeliverable(
|
||||
val hero: GiftDetailHero,
|
||||
val reason: GiftDetailUndeliverable
|
||||
) : GiftDetailReceived
|
||||
}
|
||||
|
||||
data object GiftDetailAddressForm {
|
||||
val showsPrivacyNotice = true
|
||||
val fields = listOf(
|
||||
GiftDetailAddressFormField.NAME,
|
||||
GiftDetailAddressFormField.PHONE_NUMBER,
|
||||
GiftDetailAddressFormField.ZIP_CODE,
|
||||
GiftDetailAddressFormField.ADDRESS,
|
||||
GiftDetailAddressFormField.DETAIL_ADDRESS
|
||||
)
|
||||
val agreements = listOf(GiftDetailAddressAgreement.TERMS, GiftDetailAddressAgreement.PRIVACY)
|
||||
val cta = GiftDetailAddressFormCta.RECEIVE_GIFT
|
||||
}
|
||||
|
||||
enum class GiftDetailAddressFormField(val required: Boolean) {
|
||||
NAME(true),
|
||||
PHONE_NUMBER(true),
|
||||
ZIP_CODE(true),
|
||||
ADDRESS(true),
|
||||
DETAIL_ADDRESS(false)
|
||||
}
|
||||
|
||||
enum class GiftDetailAddressAgreement { TERMS, PRIVACY }
|
||||
|
||||
enum class GiftDetailAddressFormCta { RECEIVE_GIFT }
|
||||
|
||||
enum class GiftDetailAction { TRACKING, CANCEL, INQUIRY, POLICY }
|
||||
|
||||
@@ -20,9 +20,16 @@ object GiftDetailPresenter {
|
||||
"DELIVERED" to Key.DELIVERED_LABEL
|
||||
)
|
||||
private val knownStates = normalStates.keys + setOf("UNDELIVERABLE", "CANCELED")
|
||||
private val receivedAddressCompletedStates = setOf(
|
||||
"TRACKING_REGISTERED",
|
||||
"ARRIVED_AT_MAILBOX",
|
||||
"INSPECTION_COMPLETED"
|
||||
)
|
||||
private val utcPattern = Regex("([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2})(?:\\.[0-9]{1,9})?(?:Z|\\+00:00)")
|
||||
|
||||
fun present(detail: GiftDetailResponse, cancel: GiftCancelResponse? = null): GiftDetailUiModel {
|
||||
if (detail.direction == "RECEIVED") return presentReceived(detail)
|
||||
|
||||
val status = if (cancel != null) "CANCELED" else detail.status
|
||||
val info = detail.giftInfo
|
||||
val history = detail.statusTimeline.associateBy { it.status }
|
||||
@@ -99,13 +106,108 @@ object GiftDetailPresenter {
|
||||
},
|
||||
cancellation = cancellation,
|
||||
actions = buildSet {
|
||||
if (status in knownStates && detail.trackingRequired) add(GiftDetailAction.TRACKING)
|
||||
if (detail.direction == "SENT" && status in knownStates && detail.trackingRequired) add(GiftDetailAction.TRACKING)
|
||||
if (detail.direction == "SENT" && status == "RECEIVED") add(GiftDetailAction.CANCEL)
|
||||
add(GiftDetailAction.INQUIRY)
|
||||
}
|
||||
},
|
||||
received = null
|
||||
)
|
||||
}
|
||||
|
||||
private fun presentReceived(detail: GiftDetailResponse): GiftDetailUiModel {
|
||||
val shippingRequestedDate = formatCardDate(detail.giftInfo.shippingRequestedAt)
|
||||
val deliveredDate = formatCardDate(
|
||||
detail.statusTimeline.firstOrNull { it.status == "DELIVERED" }?.occurredAt
|
||||
)
|
||||
val received: GiftDetailReceived? = when (detail.status) {
|
||||
"CANCELED" -> null
|
||||
"UNDELIVERABLE" -> GiftDetailReceived.Undeliverable(
|
||||
hero = GiftDetailHero(Key.UNDELIVERABLE_LABEL, Key.UNDELIVERABLE_TITLE, Key.UNDELIVERABLE_BODY),
|
||||
reason = GiftDetailUndeliverable(
|
||||
detail.delivery.undeliverableReason?.let(::Raw) ?: Key.UNDELIVERABLE_LABEL,
|
||||
Key.DISPOSAL_NON_RETURN_GUIDANCE
|
||||
)
|
||||
)
|
||||
"DELIVERED" -> GiftDetailReceived.Delivered(
|
||||
hero = GiftDetailHero(Key.DELIVERED_LABEL, Key.RECIPIENT_DELIVERED_TITLE, null),
|
||||
giftInfoRows = receivedGiftRows(detail, shippingRequestedDate, deliveredDate),
|
||||
recipientAddress = detail.recipientAddress?.toUiModel(),
|
||||
recipientAddressGuidance = detail.recipientAddress?.let {
|
||||
Key.RECIPIENT_ADDRESS_REMOVAL_GUIDANCE
|
||||
}
|
||||
)
|
||||
else -> when {
|
||||
detail.recipientAddressRequired -> GiftDetailReceived.AddressForm(
|
||||
pendingGiftRows = receivedGiftRows(detail),
|
||||
addressForm = GiftDetailAddressForm
|
||||
)
|
||||
detail.status in receivedAddressCompletedStates -> GiftDetailReceived.AddressCompleted(
|
||||
hero = GiftDetailHero(null, Key.RECIPIENT_ADDRESS_COMPLETED_TITLE, null),
|
||||
giftInfoRows = receivedGiftRows(detail, shippingRequestedDate),
|
||||
recipientAddress = detail.recipientAddress?.toUiModel()
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
val hero = when (received) {
|
||||
null -> hero(detail.status, detail.statusName)
|
||||
is GiftDetailReceived.AddressForm -> GiftDetailHero(null, Key.RECEIVED_TITLE, Key.RECEIVED_BODY)
|
||||
is GiftDetailReceived.AddressCompleted -> received.hero
|
||||
is GiftDetailReceived.Delivered -> received.hero
|
||||
is GiftDetailReceived.Undeliverable -> received.hero
|
||||
}
|
||||
val recipientAddress = when (received) {
|
||||
is GiftDetailReceived.AddressCompleted -> received.recipientAddress
|
||||
is GiftDetailReceived.Delivered -> received.recipientAddress
|
||||
else -> null
|
||||
}
|
||||
val actions = when (received) {
|
||||
null -> setOf(GiftDetailAction.INQUIRY)
|
||||
is GiftDetailReceived.AddressForm -> emptySet()
|
||||
is GiftDetailReceived.AddressCompleted, is GiftDetailReceived.Delivered -> setOf(GiftDetailAction.INQUIRY)
|
||||
is GiftDetailReceived.Undeliverable -> setOf(GiftDetailAction.INQUIRY, GiftDetailAction.POLICY)
|
||||
}
|
||||
return GiftDetailUiModel(
|
||||
applicationNo = detail.applicationNo,
|
||||
status = detail.status,
|
||||
hero = hero,
|
||||
timeline = emptyList(),
|
||||
progressSegments = emptyList(),
|
||||
showProgress = false,
|
||||
cancellationRows = emptyList(),
|
||||
giftInfo = GiftDetailInfo(
|
||||
counterpartNickname = detail.giftInfo.senderNickname,
|
||||
sizeName = detail.giftInfo.sizeName,
|
||||
categoryName = detail.giftInfo.categoryName,
|
||||
paidCan = null,
|
||||
tracking = null,
|
||||
shippingRequestedDate = null,
|
||||
inspectionDate = null,
|
||||
deliveredDate = null,
|
||||
canceledDate = null
|
||||
),
|
||||
senderInfo = null,
|
||||
mailbox = null,
|
||||
recipientAddress = recipientAddress,
|
||||
undeliverable = (received as? GiftDetailReceived.Undeliverable)?.reason,
|
||||
cancellation = null,
|
||||
actions = actions,
|
||||
received = received
|
||||
)
|
||||
}
|
||||
|
||||
private fun receivedGiftRows(
|
||||
detail: GiftDetailResponse,
|
||||
shippingRequestedDate: String? = null,
|
||||
deliveredDate: String? = null
|
||||
): List<GiftDetailInfoRow> = listOfNotNull(
|
||||
detail.giftInfo.senderNickname?.let { GiftDetailInfoRow(R.string.gift_inbox_sender, Raw(it)) },
|
||||
GiftDetailInfoRow(R.string.gift_send_size, Raw(detail.giftInfo.sizeName)),
|
||||
GiftDetailInfoRow(R.string.gift_send_category, Raw(detail.giftInfo.categoryName)),
|
||||
shippingRequestedDate?.let { GiftDetailInfoRow(R.string.gift_detail_shipping_date, Raw(it)) },
|
||||
deliveredDate?.let { GiftDetailInfoRow(R.string.gift_detail_delivered_date, Raw(it)) }
|
||||
)
|
||||
|
||||
internal fun showsTrackingAction(state: GiftDetailUiState): Boolean {
|
||||
val detail = (state as? GiftDetailUiState.Content)?.detail ?: return false
|
||||
val model = present(detail)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.v2.gift
|
||||
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.v2.gift.GiftDetailText.Key
|
||||
import kr.co.vividnext.sodalive.v2.gift.GiftDetailText.Raw
|
||||
import kr.co.vividnext.sodalive.v2.gift.data.GiftAddressResponse
|
||||
@@ -111,6 +112,206 @@ class GiftDetailPresenterTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 배송지 입력 모드는 보류 선물 정보만 노출한다`() {
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(recipientAddressRequired = true).copy(
|
||||
giftInfo = detail().giftInfo.copy(applicationNo = "중첩번호", paidCan = 999, tracking = "비밀운송장"),
|
||||
senderInfo = GiftAddressResponse("발송자", "01000000001", "발송지"),
|
||||
mailbox = GiftAddressResponse("사서함", "01000000002", "사서함주소")
|
||||
)
|
||||
)
|
||||
|
||||
val mode = model.received as GiftDetailReceived.AddressForm
|
||||
assertEquals(
|
||||
listOf(
|
||||
GiftDetailInfoRow(R.string.gift_inbox_sender, Raw("보낸팬")),
|
||||
GiftDetailInfoRow(R.string.gift_send_size, Raw("소형")),
|
||||
GiftDetailInfoRow(R.string.gift_send_category, Raw("잡화"))
|
||||
),
|
||||
mode.pendingGiftRows
|
||||
)
|
||||
assertEquals(GiftDetailAddressForm, mode.addressForm)
|
||||
assertNull(model.senderInfo)
|
||||
assertNull(model.mailbox)
|
||||
assertNull(model.giftInfo.paidCan)
|
||||
assertNull(model.giftInfo.tracking)
|
||||
assertFalse(model.toString().contains("중첩번호"))
|
||||
assertFalse(model.toString().contains("비밀운송장"))
|
||||
assertTrue(model.actions.none { it == GiftDetailAction.TRACKING || it == GiftDetailAction.CANCEL })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `배송지 입력 form descriptor는 고정 필드 약관과 수령 CTA를 제공한다`() {
|
||||
val form = (
|
||||
GiftDetailPresenter.present(receivedDetail(recipientAddressRequired = true)).received
|
||||
as GiftDetailReceived.AddressForm
|
||||
).addressForm
|
||||
|
||||
assertTrue(form.showsPrivacyNotice)
|
||||
assertEquals(
|
||||
listOf(
|
||||
GiftDetailAddressFormField.NAME,
|
||||
GiftDetailAddressFormField.PHONE_NUMBER,
|
||||
GiftDetailAddressFormField.ZIP_CODE,
|
||||
GiftDetailAddressFormField.ADDRESS,
|
||||
GiftDetailAddressFormField.DETAIL_ADDRESS
|
||||
),
|
||||
form.fields
|
||||
)
|
||||
assertEquals(listOf(true, true, true, true, false), form.fields.map { it.required })
|
||||
assertEquals(
|
||||
listOf(GiftDetailAddressAgreement.TERMS, GiftDetailAddressAgreement.PRIVACY),
|
||||
form.agreements
|
||||
)
|
||||
assertEquals(GiftDetailAddressFormCta.RECEIVE_GIFT, form.cta)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 취소 상태는 발송 전용 개인정보를 보존하지 않는다`() {
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(
|
||||
status = "CANCELED",
|
||||
recipientAddress = GiftAddressResponse("수신자", "01000000003", "수신주소")
|
||||
).copy(
|
||||
giftInfo = detail().giftInfo.copy(paidCan = 700, tracking = "비밀운송장"),
|
||||
senderInfo = GiftAddressResponse("발송자", "01000000001", "발송지"),
|
||||
mailbox = GiftAddressResponse("사서함", "01000000002", "사서함주소"),
|
||||
delivery = GiftDeliveryResponse(date, null, null)
|
||||
)
|
||||
)
|
||||
|
||||
assertNull(model.received)
|
||||
assertNull(model.senderInfo)
|
||||
assertNull(model.mailbox)
|
||||
assertNull(model.recipientAddress)
|
||||
assertNull(model.giftInfo.paidCan)
|
||||
assertNull(model.giftInfo.tracking)
|
||||
assertNull(model.cancellation)
|
||||
assertTrue(model.cancellationRows.isEmpty())
|
||||
assertTrue(
|
||||
model.actions.none {
|
||||
it == GiftDetailAction.TRACKING || it == GiftDetailAction.CANCEL || it == GiftDetailAction.POLICY
|
||||
}
|
||||
)
|
||||
assertFalse(model.toString().contains("비밀"))
|
||||
assertFalse(model.toString().contains("사서함"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 미지원 상태는 배송지 입력 완료로 분류하지 않는다`() {
|
||||
listOf("RECEIVED", "FUTURE").forEach { status ->
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(status = status).copy(
|
||||
giftInfo = detail().giftInfo.copy(paidCan = 700, tracking = "비밀운송장"),
|
||||
senderInfo = GiftAddressResponse("발송자", "01000000001", "발송지"),
|
||||
mailbox = GiftAddressResponse("사서함", "01000000002", "사서함주소")
|
||||
)
|
||||
)
|
||||
|
||||
assertNull(model.received)
|
||||
assertNull(model.senderInfo)
|
||||
assertNull(model.mailbox)
|
||||
assertNull(model.giftInfo.paidCan)
|
||||
assertNull(model.giftInfo.tracking)
|
||||
assertTrue(
|
||||
model.actions.none {
|
||||
it == GiftDetailAction.TRACKING || it == GiftDetailAction.CANCEL || it == GiftDetailAction.POLICY
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 배송지 입력 완료 모드는 진행 상태별 네 행과 선택 주소를 만든다`() {
|
||||
listOf("TRACKING_REGISTERED", "ARRIVED_AT_MAILBOX", "INSPECTION_COMPLETED").forEach { status ->
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(status = status, recipientAddress = GiftAddressResponse("수신자", "01000000003", "수신주소"))
|
||||
)
|
||||
|
||||
val mode = model.received as GiftDetailReceived.AddressCompleted
|
||||
assertEquals(Key.RECIPIENT_ADDRESS_COMPLETED_TITLE, mode.hero.title)
|
||||
assertEquals(
|
||||
listOf(
|
||||
R.string.gift_inbox_sender,
|
||||
R.string.gift_send_size,
|
||||
R.string.gift_send_category,
|
||||
R.string.gift_detail_shipping_date
|
||||
),
|
||||
mode.giftInfoRows.map { it.label }
|
||||
)
|
||||
assertEquals(GiftDetailAddress("수신자", "01000000003", "수신주소"), mode.recipientAddress)
|
||||
assertEquals(setOf(GiftDetailAction.INQUIRY), model.actions)
|
||||
assertTrue(model.actions.none { it == GiftDetailAction.TRACKING || it == GiftDetailAction.CANCEL })
|
||||
}
|
||||
listOf<String?>(null, "bad").forEach { shippingRequestedAt ->
|
||||
val missingDate = GiftDetailPresenter.present(
|
||||
receivedDetail(status = "TRACKING_REGISTERED").copy(
|
||||
giftInfo = detail().giftInfo.copy(shippingRequestedAt = shippingRequestedAt)
|
||||
)
|
||||
).received as GiftDetailReceived.AddressCompleted
|
||||
assertEquals(3, missingDate.giftInfoRows.size)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 배송지 입력 완료 모드는 주소가 없으면 주소 section을 만들지 않는다`() {
|
||||
val model = GiftDetailPresenter.present(receivedDetail(status = "TRACKING_REGISTERED"))
|
||||
|
||||
val mode = model.received as GiftDetailReceived.AddressCompleted
|
||||
assertNull(mode.recipientAddress)
|
||||
assertNull(model.recipientAddress)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 전달 완료 모드는 이력 배송 완료일과 주소 삭제 안내를 사용한다`() {
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(
|
||||
status = "DELIVERED",
|
||||
recipientAddressRequired = true,
|
||||
recipientAddress = GiftAddressResponse("수신자", "01000000003", "수신주소")
|
||||
).copy(
|
||||
statusTimeline = listOf(GiftStatusTimelineResponse("DELIVERED", "전달", "2026-10-02T18:30:00Z"))
|
||||
)
|
||||
)
|
||||
|
||||
val mode = model.received as GiftDetailReceived.Delivered
|
||||
assertEquals(Key.RECIPIENT_ADDRESS_REMOVAL_GUIDANCE, mode.recipientAddressGuidance)
|
||||
assertEquals(Key.RECIPIENT_DELIVERED_TITLE, mode.hero.title)
|
||||
assertEquals(5, mode.giftInfoRows.size)
|
||||
assertEquals(
|
||||
GiftDetailInfoRow(R.string.gift_detail_delivered_date, Raw("2026.10.03")),
|
||||
mode.giftInfoRows.last()
|
||||
)
|
||||
assertEquals(GiftDetailAddress("수신자", "01000000003", "수신주소"), mode.recipientAddress)
|
||||
assertEquals(setOf(GiftDetailAction.INQUIRY), model.actions)
|
||||
|
||||
val withoutAddress = GiftDetailPresenter.present(
|
||||
receivedDetail(status = "DELIVERED", recipientAddressRequired = true)
|
||||
).received as GiftDetailReceived.Delivered
|
||||
assertNull(withoutAddress.recipientAddress)
|
||||
assertNull(withoutAddress.recipientAddressGuidance)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물 전달 불가 모드는 주소를 숨기고 사유와 정책 액션을 제공한다`() {
|
||||
val model = GiftDetailPresenter.present(
|
||||
receivedDetail(
|
||||
status = "UNDELIVERABLE",
|
||||
recipientAddressRequired = true,
|
||||
recipientAddress = GiftAddressResponse("수신자", "01000000003", "수신주소")
|
||||
)
|
||||
)
|
||||
|
||||
val mode = model.received as GiftDetailReceived.Undeliverable
|
||||
assertEquals(GiftDetailHero(Key.UNDELIVERABLE_LABEL, Key.UNDELIVERABLE_TITLE, Key.UNDELIVERABLE_BODY), mode.hero)
|
||||
assertEquals(GiftDetailUndeliverable(Key.UNDELIVERABLE_LABEL, Key.DISPOSAL_NON_RETURN_GUIDANCE), mode.reason)
|
||||
assertEquals(setOf(GiftDetailAction.INQUIRY, GiftDetailAction.POLICY), model.actions)
|
||||
assertNull(model.recipientAddress)
|
||||
assertFalse(model.toString().contains("수신주소"))
|
||||
assertTrue(model.actions.none { it == GiftDetailAction.TRACKING || it == GiftDetailAction.CANCEL })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `받은 선물의 본인 주소와 보낸 사람 사서함은 대체 없이 구분한다`() {
|
||||
val source = detail().copy(
|
||||
@@ -122,10 +323,14 @@ class GiftDetailPresenterTest {
|
||||
assertEquals("발송지", sent.senderInfo?.address)
|
||||
assertEquals("사서함주소", sent.mailbox?.address)
|
||||
assertEquals("크리에이터", sent.giftInfo.counterpartNickname)
|
||||
val received = GiftDetailPresenter.present(source.copy(direction = "RECEIVED"))
|
||||
val received = GiftDetailPresenter.present(source.copy(direction = "RECEIVED", status = "TRACKING_REGISTERED"))
|
||||
assertEquals(GiftDetailAddress("수신자", "01000000003", "수신주소"), received.recipientAddress)
|
||||
assertEquals("보낸팬", received.giftInfo.counterpartNickname)
|
||||
assertNull(GiftDetailPresenter.present(source.copy(direction = "RECEIVED", recipientAddress = null)).recipientAddress)
|
||||
assertNull(
|
||||
GiftDetailPresenter.present(
|
||||
source.copy(direction = "RECEIVED", status = "TRACKING_REGISTERED", recipientAddress = null)
|
||||
).recipientAddress
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -212,7 +417,7 @@ class GiftDetailPresenterTest {
|
||||
)
|
||||
assertEquals(
|
||||
"$status $direction trackingRequired=$required",
|
||||
status in knownStates && required,
|
||||
direction == "SENT" && status in knownStates && required,
|
||||
GiftDetailAction.TRACKING in model.actions
|
||||
)
|
||||
assertEquals(direction == "SENT" && status == "RECEIVED", GiftDetailAction.CANCEL in model.actions)
|
||||
@@ -221,7 +426,7 @@ class GiftDetailPresenterTest {
|
||||
}
|
||||
}
|
||||
assertEquals(GiftDetailHero(null, Raw("서버 상태"), null), present("FUTURE").hero)
|
||||
assertEquals(setOf("TRACKING", "CANCEL", "INQUIRY"), GiftDetailAction.entries.map { it.name }.toSet())
|
||||
assertEquals(setOf("TRACKING", "CANCEL", "INQUIRY", "POLICY"), GiftDetailAction.entries.map { it.name }.toSet())
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -244,6 +449,11 @@ class GiftDetailPresenterTest {
|
||||
assertEquals("10.02", GiftDetailPresenter.formatProgressDate(it))
|
||||
assertEquals("2026.10.02", GiftDetailPresenter.formatCardDate(it))
|
||||
}
|
||||
val boundary = "2026-10-11T23:30:00Z"
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"))
|
||||
assertEquals("2026.10.12", GiftDetailPresenter.formatCardDate(boundary))
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
|
||||
assertEquals("2026.10.11", GiftDetailPresenter.formatCardDate(boundary))
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
|
||||
assertEquals("10.01", GiftDetailPresenter.formatProgressDate(date))
|
||||
assertEquals("2026.10.01", GiftDetailPresenter.formatCardDate(date))
|
||||
@@ -290,7 +500,7 @@ class GiftDetailPresenterTest {
|
||||
@Test
|
||||
fun `취소 본문은 수신 크리에이터와 최상위 번호를 쓰고 일곱 행에 영 환불을 보존한다`() {
|
||||
val source = detail("CANCELED").copy(
|
||||
direction = "RECEIVED",
|
||||
direction = "SENT",
|
||||
giftInfo = detail().giftInfo.copy(applicationNo = "중첩번호", paidCan = 0),
|
||||
delivery = GiftDeliveryResponse(date, null, null),
|
||||
statusTimeline = listOf(GiftStatusTimelineResponse("RECEIVED", "접수", date))
|
||||
@@ -336,6 +546,17 @@ class GiftDetailPresenterTest {
|
||||
|
||||
private fun present(status: String) = GiftDetailPresenter.present(detail(status))
|
||||
|
||||
private fun receivedDetail(
|
||||
status: String = "RECEIVED",
|
||||
recipientAddressRequired: Boolean = false,
|
||||
recipientAddress: GiftAddressResponse? = null
|
||||
) = detail(status).copy(
|
||||
direction = "RECEIVED",
|
||||
recipientAddressRequired = recipientAddressRequired,
|
||||
recipientAddress = recipientAddress,
|
||||
giftInfo = detail().giftInfo.copy(shippingRequestedAt = date)
|
||||
)
|
||||
|
||||
private fun detail(status: String = "RECEIVED") = GiftDetailResponse(
|
||||
"GIFT-1", "SENT", status, "서버 상태",
|
||||
GiftDetailInfoResponse("크리에이터", "보낸팬", "소형", "잡화", null, null, null, null),
|
||||
|
||||
Reference in New Issue
Block a user