2896-route_tickets_refactor + transactions + unitest + e2e #623

Merged
joan merged 16 commits from 2896-route_tickets_refactor into dev 2021-05-17 10:32:45 +00:00
2 changed files with 10 additions and 7 deletions
Showing only changes of commit b902a4dd4a - Show all commits

View File

@ -72,7 +72,7 @@ module.exports = Self => {
const tickets = await conn.executeStmt(stmt, myOptions); const tickets = await conn.executeStmt(stmt, myOptions);
if (tickets.length === 1 && !tickets[0].id) return; if (tickets.length === 1 && !tickets[0].id) return [];
return tickets; return tickets;
}; };

View File

@ -13,7 +13,10 @@ describe('Route', () => {
const $element = angular.element('<vn-route-tickets></vn-route-tickets>'); const $element = angular.element('<vn-route-tickets></vn-route-tickets>');
controller = $componentController('vnRouteTickets', {$element, $scope}); controller = $componentController('vnRouteTickets', {$element, $scope});
controller.route = {id: 1}; controller.route = {id: 1};
controller.$.model = {refresh: () => {}}; controller.$.model = {
refresh: () => {},
remove: () => {}
};
controller.card = {reload: () => {}}; controller.card = {reload: () => {}};
})); }));
@ -98,11 +101,9 @@ describe('Route', () => {
{ {
id: 1, id: 1,
checked: true, checked: true,
address: { street: 'my street',
street: 'my street', postalCode: 'n19',
postalCode: 'n19', city: 'London'
city: 'London'
}
}, },
]; ];
@ -130,6 +131,8 @@ describe('Route', () => {
it('should perform a patch query then call showSuccess and updateVolume methods', () => { it('should perform a patch query then call showSuccess and updateVolume methods', () => {
jest.spyOn(controller, 'updateVolume').mockReturnThis(); jest.spyOn(controller, 'updateVolume').mockReturnThis();
jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.vnApp, 'showSuccess');
jest.spyOn(controller.$.model, 'remove');
let ticketId = 1; let ticketId = 1;
controller.selectedTicket = ticketId; controller.selectedTicket = ticketId;