Updated on 2026-08-14
This commit is contained in:
parent
2b943f239f
commit
49f24cf911
14 changed files with 132 additions and 117 deletions
|
|
@ -10,11 +10,6 @@ sealed interface PromoCampaignState {
|
|||
val timeline: PromoTimeline,
|
||||
) : PromoCampaignState
|
||||
|
||||
data class Enrolled(
|
||||
override val campaign: PromoCampaignId,
|
||||
val tokenReward: TokenReward,
|
||||
) : PromoCampaignState
|
||||
|
||||
data class NotActive(
|
||||
override val campaign: PromoCampaignId,
|
||||
) : PromoCampaignState
|
||||
|
|
|
|||
|
|
@ -19,11 +19,19 @@ data class PromoTimeline(
|
|||
data class TokenReward(
|
||||
val tokenAddress: String,
|
||||
val networkId: String,
|
||||
val userAddress: String,
|
||||
val tokenId: String,
|
||||
)
|
||||
|
||||
data class EnrolledTokenReward(
|
||||
val tokenAddress: String,
|
||||
val networkId: String,
|
||||
val tokenId: String,
|
||||
)
|
||||
|
||||
sealed interface EnrollResult {
|
||||
val tokenReward: TokenReward
|
||||
val tokenReward: EnrolledTokenReward
|
||||
|
||||
data class Success(override val tokenReward: TokenReward) : EnrollResult
|
||||
data class AlreadyEnrolled(override val tokenReward: TokenReward) : EnrollResult
|
||||
data class Success(override val tokenReward: EnrolledTokenReward) : EnrollResult
|
||||
data class AlreadyEnrolled(override val tokenReward: EnrolledTokenReward) : EnrollResult
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.google.common.truth.Truth.assertThat
|
|||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.promo.PromoRepository
|
||||
import com.tangem.domain.promo.models.EnrollResult
|
||||
import com.tangem.domain.promo.models.EnrolledTokenReward
|
||||
import com.tangem.domain.promo.models.PromoCampaignId
|
||||
import com.tangem.domain.promo.models.TokenReward
|
||||
import com.tangem.test.core.assertEitherLeft
|
||||
|
|
@ -24,7 +25,8 @@ internal class EnrollPromoCampaignUseCaseTest {
|
|||
|
||||
private val campaign = PromoCampaignId.WhaleSwapCashback
|
||||
private val walletIds = listOf(UserWalletId("abcdef012345"))
|
||||
private val tokenReward = TokenReward("0xToken", "ethereum")
|
||||
private val tokenReward = TokenReward("0xToken", "ethereum", "0xUser", "tether")
|
||||
private val resultTokenReward = EnrolledTokenReward("0xToken", "ethereum", "tether")
|
||||
|
||||
@BeforeEach
|
||||
fun setUp() = clearMocks(repository)
|
||||
|
|
@ -32,7 +34,7 @@ internal class EnrollPromoCampaignUseCaseTest {
|
|||
@Test
|
||||
fun `GIVEN repo returns Success WHEN invoke THEN Right Success`() = runTest {
|
||||
// Arrange
|
||||
val expected = EnrollResult.Success(tokenReward)
|
||||
val expected = EnrollResult.Success(resultTokenReward)
|
||||
coEvery { repository.enroll(campaign, tokenReward, walletIds) } returns expected
|
||||
|
||||
// Act
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue