diff --git a/app/soapbox/utils/__tests__/emoji-reacts.test.ts b/app/soapbox/utils/__tests__/emoji-reacts.test.ts index 9b901614cd..5d64fdf3dc 100644 --- a/app/soapbox/utils/__tests__/emoji-reacts.test.ts +++ b/app/soapbox/utils/__tests__/emoji-reacts.test.ts @@ -193,6 +193,18 @@ describe('simulateEmojiReact', () => { { 'count': 1, 'me': true, 'name': '😯', 'url': undefined }, ])); }); + + it('adds a custom emoji to the list', () => { + const emojiReacts = fromJS([ + { 'count': 2, 'me': false, 'name': '👍', 'url': undefined }, + { 'count': 2, 'me': false, 'name': '❤', 'url': undefined }, + ]) as ImmutableList>; + expect(simulateEmojiReact(emojiReacts, 'soapbox', 'https://gleasonator.com/emoji/Gleasonator/soapbox.png')).toEqual(fromJS([ + { 'count': 2, 'me': false, 'name': '👍', 'url': undefined }, + { 'count': 2, 'me': false, 'name': '❤', 'url': undefined }, + { 'count': 1, 'me': true, 'name': 'soapbox', 'url': 'https://gleasonator.com/emoji/Gleasonator/soapbox.png' }, + ])); + }); }); describe('simulateUnEmojiReact', () => { @@ -218,4 +230,16 @@ describe('simulateUnEmojiReact', () => { { 'count': 2, 'me': false, 'name': '❤' }, ])); }); + + it ('removes custom emoji from the list', () => { + const emojiReacts = fromJS([ + { 'count': 2, 'me': false, 'name': '👍' }, + { 'count': 2, 'me': false, 'name': '❤' }, + { 'count': 1, 'me': true, 'name': 'soapbox', 'url': 'https://gleasonator.com/emoji/Gleasonator/soapbox.png' }, + ]) as ImmutableList>; + expect(simulateUnEmojiReact(emojiReacts, 'soapbox')).toEqual(fromJS([ + { 'count': 2, 'me': false, 'name': '👍' }, + { 'count': 2, 'me': false, 'name': '❤' }, + ])); + }); });