4033-route #1050
|
@ -58,9 +58,23 @@ describe('Route', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('setHighestPriority()', () => {
|
||||||
|
it('should set a ticket highest priority', () => {
|
||||||
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
controller.$.model.data = [{priority: 3}];
|
||||||
|
const ticket = {id: 1, priority: 2};
|
||||||
|
const res = {data: {priority: 4}};
|
||||||
|
|
||||||
|
$httpBackend.expectPATCH(`Tickets/${ticket.id}/`).respond(res);
|
||||||
|
controller.setHighestPriority(ticket);
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('setPriority()', () => {
|
describe('setPriority()', () => {
|
||||||
it('should set a ticket priority', () => {
|
it('should set a ticket priority', () => {
|
||||||
jest.spyOn(controller.$.model, 'refresh');
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
const priority = 999;
|
const priority = 999;
|
||||||
|
@ -69,6 +83,35 @@ describe('Route', () => {
|
||||||
controller.setPriority(ticketId, priority);
|
controller.setPriority(ticketId, priority);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('deletePriority()', () => {
|
||||||
|
it('should delete priority of all tickets', () => {
|
||||||
|
jest.spyOn(controller.$.model, 'refresh');
|
||||||
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
controller.tickets = [{id: 1, checked: true}];
|
||||||
|
|
||||||
|
$httpBackend.expectPATCH(`Tickets/${controller.tickets[0].id}/`).respond();
|
||||||
|
controller.deletePriority();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
|
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setOrderedPriority()', () => {
|
||||||
|
it('should set priority of all tickets starting by 1', () => {
|
||||||
|
jest.spyOn(controller.$.model, 'refresh');
|
||||||
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
const tickets = [{id: 1, checked: true}];
|
||||||
|
|
||||||
|
$httpBackend.expectPATCH(`Tickets/${tickets[0].id}/`).respond();
|
||||||
|
controller.setOrderedPriority(tickets);
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue