feat(widget): 랭킹 순위 변동 표시 옵션을 추가한다
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package kr.co.vividnext.sodalive.v2.widget.creatorranking
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.widget.ranking.RankingChangeType
|
||||
import kr.co.vividnext.sodalive.v2.widget.ranking.RankingChangeType.Increase
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
@@ -45,23 +46,45 @@ class CreatorRankingItemTest {
|
||||
assertEquals("크리에이터 이름", item.displayName(inaccessibleMessage = "접근할 수 없는 정보입니다."))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `순위 변동 표시는 기본값이 true이다`() {
|
||||
val item = sampleItem()
|
||||
|
||||
assertTrue(item.showRankChange)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `순위 변동 표시는 숨김 처리할 수 있다`() {
|
||||
val item = sampleItem(showRankChange = false)
|
||||
|
||||
assertFalse(item.showRankChange)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `차단된 creator id 아이템은 터치할 수 없다`() {
|
||||
val item = sampleItem(creatorId = 0L, isBlocked = true)
|
||||
|
||||
assertTrue(item.isInaccessible)
|
||||
assertFalse(item.isTouchable)
|
||||
}
|
||||
|
||||
private fun sampleItem(
|
||||
creatorId: Long = 1L,
|
||||
rank: Int = 1,
|
||||
previousRank: Int? = 5,
|
||||
rankChangeType: RankingChangeType = RankingChangeType.Increase,
|
||||
rankChangeType: RankingChangeType = Increase,
|
||||
rankChangeAmount: Int = 4,
|
||||
creatorName: String = "크리에이터 이름",
|
||||
imageUrl: String = "https://example.com/image.png",
|
||||
isBlocked: Boolean = false
|
||||
isBlocked: Boolean = false,
|
||||
showRankChange: Boolean = true
|
||||
) = CreatorRankingItem(
|
||||
creatorId = creatorId,
|
||||
rank = rank,
|
||||
previousRank = previousRank,
|
||||
rankChangeType = rankChangeType,
|
||||
rankChangeAmount = rankChangeAmount,
|
||||
creatorName = creatorName,
|
||||
imageUrl = imageUrl,
|
||||
isBlocked = isBlocked
|
||||
isBlocked = isBlocked,
|
||||
showRankChange = showRankChange
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user