7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
3 changed files with 13 additions and 9 deletions
Showing only changes of commit d4d3fdceb5 - Show all commits

View File

@ -47,8 +47,6 @@ module.exports = Self => {
}]
}, myOptions);
console.log('id', id);
console.log('ticket', ticket);
const now = Date.vnNew();
const maxDate = new Date(ticket.creationDate);
maxDate.setHours(maxDate.getHours() + 1);

View File

@ -68,7 +68,7 @@ describe('ticket filter()', () => {
const filter = {};
const result = await models.Ticket.filter(ctx, filter, options);
expect(result.length).toEqual(6);
expect(result.length).toEqual(5);
await tx.rollback();
} catch (e) {

View File

@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
const models = app.models;
describe('ticket restore()', () => {
fdescribe('ticket restore()', () => {
const employeeUser = 1110;
const ticketId = 18;
const ticketId = 9;
const activeCtx = {
accessToken: {userId: employeeUser},
headers: {
@ -48,25 +48,31 @@ describe('ticket restore()', () => {
const tx = await app.models.Ticket.beginTransaction({});
const now = Date.vnNew();
console.log('now', now);
try {
const options = {transaction: tx};
const ticketBeforeUpdate = await models.Ticket.findById(ticketId, null, options);
const ticketBeforeUpdate = await models.TicketLog.findById(ticketId, null, options);
await ticketBeforeUpdate.updateAttributes({
isDeleted: true,
updated: now
creationDate: '2001-01-01T11:00:00.000Z',
}, options);
const ticketAfterUpdate = await models.Ticket.findById(ticketId, null, options);
console.log('ticketBeforeUpdate', ticketBeforeUpdate);
const ticketAfterUpdate = await models.TicketLog.findById(ticketId, null, options);
console.log('ticketAfterUpdate: ', ticketAfterUpdate);
expect(ticketAfterUpdate.isDeleted).toBeTruthy();
await models.Ticket.restore(ctx, ticketId, options);
const ticketAfterRestore = await models.Ticket.findById(ticketId, null, options);
console.log('ticketAfterRestore: ', ticketAfterRestore);
const fullYear = now.getFullYear();
console.log('fullYear: ', fullYear);
const shippedFullYear = ticketAfterRestore.shipped.getFullYear();
console.log('shippedFullYear: ', shippedFullYear);
const landedFullYear = ticketAfterRestore.landed.getFullYear();
console.log('landedFullYear: ', landedFullYear);
expect(ticketAfterRestore.isDeleted).toBeFalsy();
expect(shippedFullYear).toEqual(fullYear);