mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-17 07:09:17 +08:00
Add test for test Audio extraData
This commit is contained in:
parent
dcc418a557
commit
0f26dbff5c
@ -21,9 +21,8 @@ import net.mamoe.mirai.internal.utils.structureToString
|
||||
import net.mamoe.mirai.message.MessageSerializers
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.utils.cast
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
import net.mamoe.mirai.utils.mapToByteArray
|
||||
import kotlin.test.*
|
||||
|
||||
internal class MessageSerializationTest : AbstractTest() {
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@ -311,4 +310,15 @@ internal class MessageSerializationTest : AbstractTest() {
|
||||
|
||||
assertEquals(origin, result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test Audio extraData`() {
|
||||
val origin = OnlineAudioImpl("name", byteArrayOf(), 1, AudioCodec.SILK, "url", 2, ImMsgBody.Ptt(1))
|
||||
val result = format.parseToJsonElement(origin.serialize()).jsonObject
|
||||
|
||||
assertNotNull(origin.extraData)
|
||||
assertContentEquals(
|
||||
origin.extraData,
|
||||
result["extraData"]?.jsonArray?.mapToByteArray { it.jsonPrimitive.int.toByte() })
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user