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

BIN
Resources/RectIcon.pxd Normal file
View File

Binary file not shown.

View File

@@ -46,13 +46,15 @@ struct ContentView: View {
Button("", systemImage: "checkmark") {
if let sticker = emoji.sticker {
if sticker.validate() {
print("validation of \(emoji.name) succeeded")
Haptic.success.trigger()
} else {
print("validation of \(emoji.name) failed")
Haptic.error.trigger()
}
}
}
Spacer()
.buttonStyle(.plain)
if emoji.isLocal {
Button("", systemImage: "trash") {
emoji.deleteImage()

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()

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 922 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB