diff --git a/packages/rocketchat-api/package.js b/packages/rocketchat-api/package.js index df6d1b9b3ab4..5b0d5ffa53c2 100644 --- a/packages/rocketchat-api/package.js +++ b/packages/rocketchat-api/package.js @@ -33,6 +33,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); + }); + }); +});