From d60308f72b48d519dd0ef7e0fe9e769fcde6951f Mon Sep 17 00:00:00 2001 From: gerard Date: Thu, 13 Sep 2018 15:29:38 +0200 Subject: [PATCH] Bug #651 test --- .../loopback/common/methods/ticket/specs/deleted.spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/loopback/common/methods/ticket/specs/deleted.spec.js b/services/loopback/common/methods/ticket/specs/deleted.spec.js index 84c7b784c..e3ae23f4e 100644 --- a/services/loopback/common/methods/ticket/specs/deleted.spec.js +++ b/services/loopback/common/methods/ticket/specs/deleted.spec.js @@ -8,12 +8,15 @@ describe('ticket deleted()', () => { await app.models.TicketTracking.create({ticketFk: ticket.id, stateFk: 3}); }); - it('should change the state of a ticket to deleted, and set the property isDeleted true', async() => { + it('should make the ticket is not deleted yet', async() => { ticket = await app.models.Ticket.findOne({where: {id: 1}}); expect(ticket.isDeleted).toEqual(false); - ctx = {req: {accessToken: {userId: 9}}}; - params = {id: 1}; + }); + + it('should set a ticket to deleted and log the change on TicketState table', async() => { + let ctx = {req: {accessToken: {userId: 9}}}; + let params = {id: 1}; await app.models.Ticket.deleted(ctx, params); let deletedTicket = await app.models.Ticket.findOne({where: {id: 1}, fields: ['isDeleted']});