From bba6c9be15a23b1e091d9e8ee89a474e670fa011 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 14 Feb 2020 07:53:13 +0100 Subject: [PATCH] Return response when the sender equals recipient --- back/methods/chat/send.js | 2 ++ back/methods/chat/spec/send.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index b0a9431c7..53e5da7cc 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -32,6 +32,8 @@ module.exports = Self => { if (sender.name != recipient) return sendMessage(sender, to, message); + + return false; }; async function sendMessage(sender, channel, message) { diff --git a/back/methods/chat/spec/send.spec.js b/back/methods/chat/spec/send.spec.js index b2585a9a1..56f2a9c27 100644 --- a/back/methods/chat/spec/send.spec.js +++ b/back/methods/chat/spec/send.spec.js @@ -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(); }); });