Updated unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-02-02 08:15:20 +01:00
parent 4ac207c568
commit b34e5804ae
1 changed files with 11 additions and 1 deletions

View File

@ -8,7 +8,17 @@ describe('Chat notifyIssue()', () => {
const chatModel = app.models.Chat; const chatModel = app.models.Chat;
const departmentId = 31; 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, 'send').and.callThrough();
spyOn(chatModel, 'rawSql').and.returnValue([{title: 'Issue title'}]); spyOn(chatModel, 'rawSql').and.returnValue([{title: 'Issue title'}]);