import Foundation import Testing @testable import OrgSocialKit @Suite("EmojiShortcode – resolver") struct EmojiShortcodeResolverTests { @Test("known shortcode resolves to Unicode") func known() { #expect(EmojiShortcode.resolve(":heartbeat:") == "💓") #expect(EmojiShortcode.resolve(":thumbsup:") == "👍") #expect(EmojiShortcode.resolve(":+1:") == "👍") #expect(EmojiShortcode.resolve(":fire:") == "🔥") } @Test("unknown shortcode is left untouched") func unknown() { #expect(EmojiShortcode.resolve(":custom_emoji_123:") == ":custom_emoji_123:") } @Test("strings without any colon are returned as-is") func plain() { #expect(EmojiShortcode.resolve("❤️") == "❤️") #expect(EmojiShortcode.resolve("hello") == "hello") #expect(EmojiShortcode.resolve("") == "") } @Test("inline shortcodes inside a sentence are replaced") func inline() { #expect(EmojiShortcode.resolve("got it :thumbsup: thanks") == "got it 👍 thanks") } @Test("multiple shortcodes in one string are all resolved") func multiple() { #expect(EmojiShortcode.resolve(":heart::fire:") == "❤️🔥") } @Test("bare token without colons resolves when the whole input is a key") func bareToken() { #expect(EmojiShortcode.resolve("happy") == "😊") #expect(EmojiShortcode.resolve("heartbeat") == "💓") } @Test("dash-form shortcode is normalised to underscore form") func dashes() { #expect(EmojiShortcode.resolve(":christmas-tree:") == "🎄") #expect(EmojiShortcode.resolve("christmas-tree") == "🎄") } @Test("multi-word free text without colons is left untouched") func freeText() { #expect(EmojiShortcode.resolve("Hello world") == "Hello world") } }