Bug #651 Al borrar un ticket no se cambia su estado a eliminado test

This commit is contained in:
gerard 2018-09-13 15:13:42 +02:00
parent 447044faf9
commit d39365b63b
1 changed files with 9 additions and 6 deletions

View File

@ -1,22 +1,25 @@
const app = require(`${servicesDir}/ticket/server/server`);
// #651 Al borrar un ticket no se cambia su estado a eliminado
xdescribe('ticket deleted()', () => {
describe('ticket deleted()', () => {
let ticket;
afterAll(async() => {
ticket.isDeleted = 0;
await app.models.Ticket.upsert(ticket);
await app.models.TicketTracking.create({ticketFk: ticket.id, stateFk: 3});
});
it('YOU should work this out', async() => {
it('should change the state of a ticket to deleted, and set the property isDeleted true', async() => {
ticket = await app.models.Ticket.findOne({where: {id: 1}});
expect(ticket.isDeleted).toEqual(false);
await app.models.Ticket.deleted({id: 1});
ctx = {req: {accessToken: {userId: 9}}};
params = {id: 1};
await app.models.Ticket.deleted(ctx, params);
let deletedTicket = await app.models.Ticket.findOne({where: {id: 1}, fields: ['isDeleted']});
let changedState = await app.models.TicketState.findOne({where: {id: 1}});
expect(deletedTicket.isDeleted).toEqual(true);
expect(changedState.stateFk).toEqual(17);
});
});