statis/js/bot_data.js: Add `get_bot_owner_email` function.

This commit is contained in:
Yashashvi Dave 2018-11-16 14:44:34 +05:30 committed by Tim Abbott
parent a394778cde
commit 5759d5a762
2 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,7 @@ run_test('test_basics', () => {
full_name: 'Embedded bot 1',
services: [{config_data: {key: '12345678'},
service_name: "giphy"}],
owner: 'cordelia@zulip.com',
};
(function test_add() {
@ -156,4 +157,11 @@ run_test('test_basics', () => {
assert.equal(bots[0].email, 'bot1@zulip.com');
assert.equal(bots[1].email, 'bot2@zulip.com');
}());
(function test_get_bot_owner_email() {
let bot_owner_email = bot_data.get_bot_owner_email(test_embedded_bot.user_id);
assert.equal('cordelia@zulip.com', bot_owner_email);
bot_owner_email = bot_data.get_bot_owner_email(test_bot.user_id);
assert.equal(undefined, bot_owner_email);
}());
});

View File

@ -77,6 +77,10 @@ var bot_data = (function () {
return bots[bot_id];
};
exports.get_bot_owner_email = function (bot_id) {
return bots[bot_id].owner;
};
exports.get_services = function bot_data__get_services(bot_id) {
return services[bot_id];
};