1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

update SimpleInputFilesTest

This commit is contained in:
InsanusMokrassar 2020-08-29 19:51:10 +06:00
parent 747854f4f4
commit 9c926a2265

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals
private val nonstrictJsonFormat = Json { private val nonstrictJsonFormat = Json {
isLenient = true isLenient = true
@ -22,9 +23,17 @@ class SimpleInputFilesTest {
PhotoSize("example_file_id".toInputFile(), "example_unique_file_id", 100, 100, 100) PhotoSize("example_file_id".toInputFile(), "example_unique_file_id", 100, 100, 100)
) )
) )
nonstrictJsonFormat.encodeToString( val inputMedia = photoContent.toMediaGroupMemberInputMedia()
val encoded = nonstrictJsonFormat.encodeToString(
MediaGroupMemberInputMediaSerializer, MediaGroupMemberInputMediaSerializer,
photoContent.toMediaGroupMemberInputMedia() inputMedia
)
assertEquals(
inputMedia,
nonstrictJsonFormat.decodeFromString(
MediaGroupMemberInputMediaSerializer,
encoded
)
) )
} }
} }