diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-08-17 09:35:36 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-17 09:35:36 -0700 |
commit | fd1301779fecc2910a9fdcf93af52ff33a4349ba (patch) | |
tree | ccd8b35d347b77c8c6a99db9422b3dbc0ff3bd2d /webapp/tests/utils | |
parent | d41f1695e99a81808f5dc1fbe7820062947b5291 (diff) | |
parent | 0033e3e37b12cb5d951d21492500d66a6abc472b (diff) | |
download | chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.tar.gz chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.tar.bz2 chat-fd1301779fecc2910a9fdcf93af52ff33a4349ba.zip |
Merge branch 'release-4.1'
Diffstat (limited to 'webapp/tests/utils')
-rw-r--r-- | webapp/tests/utils/post_utils.test.jsx | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/webapp/tests/utils/post_utils.test.jsx b/webapp/tests/utils/post_utils.test.jsx new file mode 100644 index 000000000..0546d5bea --- /dev/null +++ b/webapp/tests/utils/post_utils.test.jsx @@ -0,0 +1,97 @@ +import * as PostUtils from 'utils/post_utils.jsx'; + +describe('PostUtils.containsAtMention', function() { + test('should return correct @all (same for @channel)', function() { + for (const data of [ + { + text: undefined, //eslint-disable-line no-undefined + key: undefined, //eslint-disable-line no-undefined + result: false + }, + { + text: '', + key: '', + result: false + }, + { + text: 'all', + key: '@all', + result: false + }, + { + text: '@allison', + key: '@all', + result: false + }, + { + text: '@ALLISON', + key: '@all', + result: false + }, + { + text: '@all123', + key: '@all', + result: false + }, + { + text: '123@all', + key: '@all', + result: false + }, + { + text: 'hey@all', + key: '@all', + result: false + }, + { + text: 'hey@all.com', + key: '@all', + result: false + }, + { + text: '@all', + key: '@all', + result: true + }, + { + text: '@ALL', + key: '@all', + result: true + }, + { + text: '@all hey', + key: '@all', + result: true + }, + { + text: 'hey @all', + key: '@all', + result: true + }, + { + text: 'HEY @ALL', + key: '@all', + result: true + }, + { + text: 'hey @all!', + key: '@all', + result: true + }, + { + text: 'hey @all:+1:', + key: '@all', + result: true + }, + { + text: 'hey @ALL:+1:', + key: '@all', + result: true + } + ]) { + const containsAtMention = PostUtils.containsAtMention(data.text, data.key); + + expect(containsAtMention).toEqual(data.result); + } + }); +}); |