Return response when the sender equals recipient
gitea/salix/master This commit looks good
Details
gitea/salix/master This commit looks good
Details
This commit is contained in:
parent
df21309e0a
commit
bba6c9be15
|
@ -32,6 +32,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (sender.name != recipient)
|
if (sender.name != recipient)
|
||||||
return sendMessage(sender, to, message);
|
return sendMessage(sender, to, message);
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function sendMessage(sender, channel, message) {
|
async function sendMessage(sender, channel, message) {
|
||||||
|
|
|
@ -9,10 +9,10 @@ describe('chat send()', () => {
|
||||||
expect(response.message).toEqual('Fake notification sent');
|
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 ctx = {req: {accessToken: {userId: 18}}};
|
||||||
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
||||||
|
|
||||||
expect(response).toBeUndefined();
|
expect(response).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue