Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vendelieu committed Aug 14, 2024
1 parent 5432c96 commit cb0a24f
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ package eu.vendeli.api.chat
import BotTestContext
import ChatTestingOnlyCondition
import eu.vendeli.tgbot.api.chat.createChatInviteLink
import eu.vendeli.tgbot.api.chat.createChatSubscriptionInviteLink
import eu.vendeli.tgbot.api.chat.editChatInviteLink
import eu.vendeli.tgbot.api.chat.editChatSubscriptionInviteLink
import eu.vendeli.tgbot.api.chat.exportChatInviteLink
import eu.vendeli.tgbot.api.chat.revokeChatInviteLink
import eu.vendeli.tgbot.types.internal.getOrNull
import io.kotest.core.annotation.EnabledIf
import io.kotest.matchers.booleans.shouldBeFalse
import io.kotest.matchers.booleans.shouldBeTrue
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldNotBeBlank
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds

Expand All @@ -37,6 +41,33 @@ class ChatInviteLinkMethodsTest : BotTestContext() {
}
}

@Test
suspend fun `create chat subscription invite link method test`() {
val expireUnix = CUR_INSTANT.plus(30.days)
createChatSubscriptionInviteLink(10, "test")
.sendReturning(CHAT_ID, bot)
.getOrNull()?.run {
creator.id shouldBe BOT_ID
isPrimary.shouldBeFalse()
isRevoked.shouldBeFalse()
name shouldBe "test"
createsJoinRequest.shouldBeTrue()
expireDate?.epochSeconds shouldBe expireUnix.epochSeconds
}
}

@Test
suspend fun `edit chat subscription invite link method test`() {
editChatSubscriptionInviteLink("test", "test2")
.sendReturning(CHAT_ID, bot)
.getOrNull()?.run {
creator.id shouldBe BOT_ID
isPrimary.shouldBeFalse()
isRevoked.shouldBeFalse()
name shouldBe "test2"
createsJoinRequest.shouldBeTrue()
}
}
@Test
suspend fun `edit chat invite link method test`() {
val inviteLink = createChatInviteLink()
Expand Down

0 comments on commit cb0a24f

Please sign in to comment.