feat(content): 랭킹 변동 표시 옵션을 추가한다
This commit is contained in:
@@ -12,7 +12,8 @@ data class ContentRankingItem(
|
|||||||
val contentName: String,
|
val contentName: String,
|
||||||
val creatorName: String,
|
val creatorName: String,
|
||||||
val imageUrl: String,
|
val imageUrl: String,
|
||||||
val isBlocked: Boolean
|
val isBlocked: Boolean,
|
||||||
|
val showRankChange: Boolean = true
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
require(rank >= 1) { "rank must be greater than or equal to 1." }
|
require(rank >= 1) { "rank must be greater than or equal to 1." }
|
||||||
|
|||||||
@@ -24,6 +24,20 @@ class ContentRankingItemTest {
|
|||||||
assertTrue(item.isTouchable)
|
assertTrue(item.isTouchable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `showRankChange default is true`() {
|
||||||
|
val item = sampleItem()
|
||||||
|
|
||||||
|
assertTrue(item.showRankChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `showRankChange false item does not show rank change`() {
|
||||||
|
val item = sampleItem(showRankChange = false)
|
||||||
|
|
||||||
|
assertFalse(item.showRankChange)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `top ten blocked item hides content and creator names`() {
|
fun `top ten blocked item hides content and creator names`() {
|
||||||
val item = sampleItem(rank = 10, isBlocked = true)
|
val item = sampleItem(rank = 10, isBlocked = true)
|
||||||
@@ -76,7 +90,8 @@ class ContentRankingItemTest {
|
|||||||
rank: Int = 1,
|
rank: Int = 1,
|
||||||
contentName: String = "콘텐츠 이름",
|
contentName: String = "콘텐츠 이름",
|
||||||
creatorName: String = "크리에이터 이름",
|
creatorName: String = "크리에이터 이름",
|
||||||
isBlocked: Boolean = false
|
isBlocked: Boolean = false,
|
||||||
|
showRankChange: Boolean = true
|
||||||
) = ContentRankingItem(
|
) = ContentRankingItem(
|
||||||
contentId = "content-1",
|
contentId = "content-1",
|
||||||
creatorId = "creator-1",
|
creatorId = "creator-1",
|
||||||
@@ -87,6 +102,7 @@ class ContentRankingItemTest {
|
|||||||
contentName = contentName,
|
contentName = contentName,
|
||||||
creatorName = creatorName,
|
creatorName = creatorName,
|
||||||
imageUrl = "https://example.com/image.png",
|
imageUrl = "https://example.com/image.png",
|
||||||
isBlocked = isBlocked
|
isBlocked = isBlocked,
|
||||||
|
showRankChange = showRankChange
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user