added apiemoji tests

This commit is contained in:
neon443
2025-10-31 15:06:53 +00:00
parent 8df79c7072
commit a55c4b8c31
12 changed files with 26 additions and 1 deletions

View File

@@ -8,6 +8,29 @@
import Testing
import Foundation
struct ApiEmojiTests {
@Test func ApiEmojiEncode() async throws {
let apiEmoji = ApiEmoji(name: "name", url: "https://")
let encoded = try! JSONEncoder().encode(apiEmoji)
let decoded = try! JSONDecoder().decode(ApiEmoji.self, from: encoded)
#expect(decoded == apiEmoji)
}
@Test func ApiEmojiEncoder() async throws {
let json = "{\"name\":\"name\",\"urlString\":\"https:\\/\\/\"}"
let decoded = try! JSONDecoder().decode(ApiEmoji.self, from: json.data(using: .utf8)!)
let expected = ApiEmoji(name: "name", url: "https://")
#expect(expected == ApiEmoji(name: "name", url: "https://"))
}
@Test func ApiEmojiToEmoji() async throws {
let apiEmoji = ApiEmoji(name: "name", url: "https://")
let emoji = apiEmoji.toEmoji()
let expected = Emoji(apiEmoji: apiEmoji, id: emoji.id)
#expect(emoji == expected)
}
}
struct StickerSlackTests {
var hoarder = EmojiHoarder()