From 0e75555bcd64d7a11a6be8dbbf7735cfe7d259c1 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 7 Apr 2022 08:51:07 +0200 Subject: [PATCH] Updated unit tests --- back/methods/chat/send.js | 6 +++--- modules/client/back/methods/client/specs/sendSms.spec.js | 2 -- modules/ticket/back/methods/ticket/specs/sendSms.spec.js | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index e9f1a87ca..51ecb801a 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -31,9 +31,9 @@ module.exports = Self => { const recipient = to.replace('@', ''); if (sender.name != recipient) { - await sendMessage(sender, to, message); - - return true; + const request = await sendMessage(sender, to, message); + + return request ? request : false; } return false; diff --git a/modules/client/back/methods/client/specs/sendSms.spec.js b/modules/client/back/methods/client/specs/sendSms.spec.js index 121d427ce..47e788184 100644 --- a/modules/client/back/methods/client/specs/sendSms.spec.js +++ b/modules/client/back/methods/client/specs/sendSms.spec.js @@ -1,9 +1,7 @@ const models = require('vn-loopback/server/server').models; -const soap = require('soap'); describe('client sendSms()', () => { it('should now send a message and log it', async() => { - spyOn(soap, 'createClientAsync').and.returnValue('a so fake client'); const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js index 8ec4ca487..f50253b10 100644 --- a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js +++ b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js @@ -1,5 +1,4 @@ const models = require('vn-loopback/server/server').models; -const soap = require('soap'); describe('ticket sendSms()', () => { it('should send a message and log it', async() => { @@ -8,7 +7,6 @@ describe('ticket sendSms()', () => { try { const options = {transaction: tx}; - spyOn(soap, 'createClientAsync').and.returnValue('a so fake client'); const ctx = {req: {accessToken: {userId: 9}}}; const id = 11; const destination = 222222222;