From a72a939334016c093884d6dca911d2b450872f91 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Thu, 27 Sep 2018 19:35:58 +0100 Subject: [PATCH] Add test for AutosuggestEmoji (#8805) --- .../autosuggest_emoji-test.js.snap | 27 +++++++++++++++++ .../__tests__/autosuggest_emoji-test.js | 29 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap create mode 100644 app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap new file mode 100644 index 0000000000..1c37278483 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` renders emoji with custom url 1`] = ` +
+ foobar + :foobar: +
+`; + +exports[` renders native emoji 1`] = ` +
+ 💙 + :foobar: +
+`; diff --git a/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js new file mode 100644 index 0000000000..05616e4448 --- /dev/null +++ b/app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js @@ -0,0 +1,29 @@ +import React from 'react'; +import renderer from 'react-test-renderer'; +import AutosuggestEmoji from '../autosuggest_emoji'; + +describe('', () => { + it('renders native emoji', () => { + const emoji = { + native: '💙', + colons: ':foobar:', + }; + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); + + it('renders emoji with custom url', () => { + const emoji = { + custom: true, + imageUrl: 'http://example.com/emoji.png', + native: 'foobar', + colons: ':foobar:', + }; + const component = renderer.create(); + const tree = component.toJSON(); + + expect(tree).toMatchSnapshot(); + }); +});