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

This commit is contained in:
Joan Sanchez 2022-04-07 08:51:07 +02:00
parent f5a6521f20
commit 0e75555bcd
3 changed files with 3 additions and 7 deletions

View File

@ -31,9 +31,9 @@ module.exports = Self => {
const recipient = to.replace('@', ''); const recipient = to.replace('@', '');
if (sender.name != recipient) { if (sender.name != recipient) {
await sendMessage(sender, to, message); const request = await sendMessage(sender, to, message);
return true; return request ? request : false;
} }
return false; return false;

View File

@ -1,9 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const soap = require('soap');
describe('client sendSms()', () => { describe('client sendSms()', () => {
it('should now send a message and log it', async() => { 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({}); const tx = await models.Client.beginTransaction({});
try { try {

View File

@ -1,5 +1,4 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const soap = require('soap');
describe('ticket sendSms()', () => { describe('ticket sendSms()', () => {
it('should send a message and log it', async() => { it('should send a message and log it', async() => {
@ -8,7 +7,6 @@ describe('ticket sendSms()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
const ctx = {req: {accessToken: {userId: 9}}}; const ctx = {req: {accessToken: {userId: 9}}};
const id = 11; const id = 11;
const destination = 222222222; const destination = 222222222;