diff options
Diffstat (limited to 'app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js')
-rw-r--r-- | app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js b/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js index 53efa5743..bd63d91b3 100644 --- a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js +++ b/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js @@ -44,6 +44,26 @@ describe('emoji_index', () => { expect(emojiIndex.search('apple').map(trimEmojis)).toEqual(expected); }); + it('erases custom emoji if not passed again', () => { + const custom = [ + { + id: 'mastodon', + name: 'mastodon', + short_names: ['mastodon'], + text: '', + emoticons: [], + keywords: ['mastodon'], + imageUrl: 'http://example.com', + custom: true, + }, + ]; + search('', { custom }); + emojiIndex.search('', { custom }); + const expected = []; + expect(search('masto').map(trimEmojis)).toEqual(expected); + expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected); + }); + it('handles custom emoji', () => { const custom = [ { @@ -65,12 +85,12 @@ describe('emoji_index', () => { custom: true, }, ]; - expect(search('masto').map(trimEmojis)).toEqual(expected); - expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected); + expect(search('masto', { custom }).map(trimEmojis)).toEqual(expected); + expect(emojiIndex.search('masto', { custom }).map(trimEmojis)).toEqual(expected); }); it('should filter only emojis we care about, exclude pineapple', () => { - const emojisToShowFilter = unified => unified !== '1F34D'; + const emojisToShowFilter = emoji => emoji.unified !== '1F34D'; expect(search('apple', { emojisToShowFilter }).map((obj) => obj.id)) .not.toContain('pineapple'); expect(emojiIndex.search('apple', { emojisToShowFilter }).map((obj) => obj.id)) |