Skip to content

Commit

Permalink
added enpoint and tests to get custom emoji list
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosSpessatto committed Feb 6, 2018
1 parent 8594050 commit 651a2b7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-api/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-api/server/v1/emoji-custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RocketChat.API.v1.addRoute('emoji-custom', { authRequired: true }, {
get() {
const emojis = Meteor.call('listEmojiCustom');

return RocketChat.API.v1.success({ emojis });
}
});
22 changes: 22 additions & 0 deletions tests/end-to-end/api/12-emoji-custom.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
});

0 comments on commit 651a2b7

Please sign in to comment.