Return response when the sender equals recipient
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-14 07:53:13 +01:00
parent df21309e0a
commit bba6c9be15
2 changed files with 4 additions and 2 deletions

View File

@ -32,6 +32,8 @@ module.exports = Self => {
if (sender.name != recipient)
return sendMessage(sender, to, message);
return false;
};
async function sendMessage(sender, channel, message) {

View File

@ -9,10 +9,10 @@ describe('chat send()', () => {
expect(response.message).toEqual('Fake notification sent');
});
it('should not return a response', async() => {
it('should retrun false as response', async() => {
let ctx = {req: {accessToken: {userId: 18}}};
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
expect(response).toBeUndefined();
expect(response).toBeFalsy();
});
});