front unit test fix

This commit is contained in:
Carlos Jimenez Ruiz 2021-05-14 19:56:54 +02:00
parent 97e9dc57bc
commit b902a4dd4a
2 changed files with 10 additions and 7 deletions

View File

@ -72,7 +72,7 @@ module.exports = Self => {
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;
};

View File

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