From b34e5804aecc4d6aa6494a7ec6ea129cbd118c3d Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 2 Feb 2021 08:15:20 +0100 Subject: [PATCH] Updated unit test --- back/methods/chat/spec/notifyIssue.spec.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/back/methods/chat/spec/notifyIssue.spec.js b/back/methods/chat/spec/notifyIssue.spec.js index 19fbbbd56..e23c33859 100644 --- a/back/methods/chat/spec/notifyIssue.spec.js +++ b/back/methods/chat/spec/notifyIssue.spec.js @@ -8,7 +8,17 @@ describe('Chat notifyIssue()', () => { const chatModel = app.models.Chat; const departmentId = 31; - it(`should call to notifyIssue() method then return a response calling the send() method`, async() => { + it(`should not call to the send() method and neither return a response`, async() => { + spyOn(chatModel, 'send').and.callThrough(); + spyOn(chatModel, 'rawSql').and.returnValue([]); + + const response = await chatModel.notifyIssues(ctx); + + expect(chatModel.send).not.toHaveBeenCalled(); + expect(response).toBeUndefined(); + }); + + it(`should return a response calling the send() method`, async() => { spyOn(chatModel, 'send').and.callThrough(); spyOn(chatModel, 'rawSql').and.returnValue([{title: 'Issue title'}]);