refs #6755 fix test
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-03-14 09:53:50 +01:00
parent 33bd21d40b
commit dd7c700130
2 changed files with 3 additions and 37 deletions

View File

@ -3731,3 +3731,6 @@ INSERT INTO vn.report (name) VALUES ('LabelCollection');
INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description, changedModel,oldInstance, newInstance, changedModelId, changedModelValue)
VALUES(1, 18, 'update', util.VN_CURDATE(), NULL, 'SaleGroup', '{"parkingFk":null}', '{"parkingFk":1}', 1, NULL);
INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue)
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');

View File

@ -40,29 +40,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
controller.ticket = ticket;
}));
describe('canRestoreTicket() getter', () => {
it('should return true for a ticket deleted within the last hour', () => {
controller.ticket.isDeleted = true;
controller.ticket.updated = Date.vnNew();
const result = controller.canRestoreTicket;
expect(result).toBeTruthy();
});
it('should return false for a ticket deleted more than one hour ago', () => {
const pastHour = Date.vnNew();
pastHour.setHours(pastHour.getHours() - 2);
controller.ticket.isDeleted = true;
controller.ticket.updated = pastHour;
const result = controller.canRestoreTicket;
expect(result).toBeFalsy();
});
});
describe('addTurn()', () => {
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
controller.$.addTurn = {hide: () => {}};
@ -105,20 +82,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
});
});
describe('restoreTicket()', () => {
it('should make a query to restore the ticket and call vnApp.showSuccess()', () => {
jest.spyOn(controller, 'reload').mockReturnThis();
jest.spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectPOST(`Tickets/${ticket.id}/restore`).respond();
controller.restoreTicket();
$httpBackend.flush();
expect(controller.reload).toHaveBeenCalled();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
describe('showPdfDeliveryNote()', () => {
it('should open a new window showing a delivery note PDF document', () => {
jest.spyOn(window, 'open').mockReturnThis();