diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt index bcf6f87870..68654a45e4 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt @@ -1,5 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json @@ -54,25 +55,25 @@ class ChatIdentifierTests { ) Example(chatIdentifierChatId.toChatId()).let { withChatId -> - val stringified = Json.plain.stringify(Example.serializer(), withChatId) + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withChatId) assertEquals(stringified, "{\"identifier\":$chatIdentifierChatId}") - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withChatId, deserialized) } Example(testUsername.toUsername()).let { withUsername -> - val stringified = Json.plain.stringify(Example.serializer(), withUsername) + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername) assertEquals(stringified, "{\"identifier\":\"$testUsername\"}") - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } // Replace @ by empty string, because from time to time we can retrieve from Telegram system // username without starting @ symbol Example(testUsername.toUsername()).let { withUsername -> - val stringified = Json.plain.stringify(Example.serializer(), withUsername).replace("@", "") + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") assertEquals("{\"identifier\":\"${testUsername.replace("@", "")}\"}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } }