7152-devToTest_2414 #2228
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue