Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2783-itemPriceFixed_advanced_search
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Padawan 2021-02-11 18:41:41 +01:00
commit 53b06bc464
1 changed files with 9 additions and 4 deletions

View File

@ -2,12 +2,13 @@ const app = require('vn-loopback/server/server');
let UserError = require('vn-loopback/util/user-error'); let UserError = require('vn-loopback/util/user-error');
describe('ticket new()', () => { describe('ticket new()', () => {
let ticket; let ticketIdsToDelete = [];
let today = new Date(); let today = new Date();
let ctx = {req: {accessToken: {userId: 1}}}; let ctx = {req: {accessToken: {userId: 1}}};
afterAll(async done => { afterAll(async done => {
await app.models.Ticket.destroyById(ticket.id); for (id of ticketIdsToDelete)
await app.models.Ticket.destroyById(id);
done(); done();
}); });
@ -74,7 +75,7 @@ describe('ticket new()', () => {
agencyModeId: 1 agencyModeId: 1
}; };
ticket = await app.models.Ticket.new(ctx, const ticket = await app.models.Ticket.new(ctx,
params.clientId, params.clientId,
params.shipped, params.shipped,
params.landed, params.landed,
@ -85,6 +86,8 @@ describe('ticket new()', () => {
let newestTicketIdInFixtures = 21; let newestTicketIdInFixtures = 21;
ticketIdsToDelete.push(ticket.id);
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures); expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
}); });
@ -99,7 +102,7 @@ describe('ticket new()', () => {
agencyModeId: null agencyModeId: null
}; };
ticket = await app.models.Ticket.new(ctx, const ticket = await app.models.Ticket.new(ctx,
params.clientId, params.clientId,
params.shipped, params.shipped,
params.landed, params.landed,
@ -108,6 +111,8 @@ describe('ticket new()', () => {
params.addressId, params.addressId,
params.agencyModeId); params.agencyModeId);
ticketIdsToDelete.push(ticket.id);
expect(ticket.shipped).toEqual(jasmine.any(Date)); expect(ticket.shipped).toEqual(jasmine.any(Date));
}); });
}); });