From 651a2b7dcf819795d8bc4af33df9eb4eac045d9d Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Tue, 6 Feb 2018 21:16:34 -0200 Subject: [PATCH] added enpoint and tests to get custom emoji list --- packages/rocketchat-api/package.js | 1 + .../rocketchat-api/server/v1/emoji-custom.js | 7 ++++++ tests/end-to-end/api/12-emoji-custom.js | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 packages/rocketchat-api/server/v1/emoji-custom.js create mode 100644 tests/end-to-end/api/12-emoji-custom.js diff --git a/packages/rocketchat-api/package.js b/packages/rocketchat-api/package.js index 859ca35ffdf0..e1578ade6717 100644 --- a/packages/rocketchat-api/package.js +++ b/packages/rocketchat-api/package.js @@ -36,6 +36,7 @@ Package.onUse(function(api) { api.addFiles('server/v1/subscriptions.js', 'server'); api.addFiles('server/v1/chat.js', 'server'); api.addFiles('server/v1/commands.js', 'server'); + api.addFiles('server/v1/emoji-custom.js', 'server'); api.addFiles('server/v1/groups.js', 'server'); api.addFiles('server/v1/im.js', 'server'); api.addFiles('server/v1/integrations.js', 'server'); diff --git a/packages/rocketchat-api/server/v1/emoji-custom.js b/packages/rocketchat-api/server/v1/emoji-custom.js new file mode 100644 index 000000000000..f1ad75e9dd9d --- /dev/null +++ b/packages/rocketchat-api/server/v1/emoji-custom.js @@ -0,0 +1,7 @@ +RocketChat.API.v1.addRoute('emoji-custom', { authRequired: true }, { + get() { + const emojis = Meteor.call('listEmojiCustom'); + + return RocketChat.API.v1.success({ emojis }); + } +}); diff --git a/tests/end-to-end/api/12-emoji-custom.js b/tests/end-to-end/api/12-emoji-custom.js new file mode 100644 index 000000000000..0e73f7688a8b --- /dev/null +++ b/tests/end-to-end/api/12-emoji-custom.js @@ -0,0 +1,22 @@ +/* eslint-env mocha */ +/* globals expect */ + +import {getCredentials, api, request, credentials } from '../../data/api-data.js'; + +describe('[EmojiCustom]', function() { + this.retries(0); + + before(done => getCredentials(done)); + + describe('GET', () => { + it('[/emoji-custom]', (done) => { + request.get(api('emoji-custom')) + .set(credentials) + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('emojis').and.to.be.a('array'); + }) + .end(done); + }); + }); +});