corrected spec descriptions

This commit is contained in:
Carlos Jimenez 2018-04-16 17:13:58 +02:00
parent 8537752d3c
commit f2f1579fa9
1 changed files with 9 additions and 11 deletions

View File

@ -22,18 +22,16 @@ describe('ticket', () => {
controller = $componentController('vnTicketVolume', {$scope: $scope}, {$httpBackend: $httpBackend}, {$state: $state}); controller = $componentController('vnTicketVolume', {$scope: $scope}, {$httpBackend: $httpBackend}, {$state: $state});
})); }));
describe('total()', () => { it('should join the sale volumes to its respective sale', () => {
it('should return the sum from all componenets in each sale', () => { controller.ticket = {id: 1};
controller.ticket = {id: 1}; let response = {volumes: [[{saleFk: 1, m3: 0.008}, {saleFk: 2, m3: 0.003}]]};
let response = {volumes: [[{saleFk: 1, m3: 0.008}, {saleFk: 2, m3: 0.003}]]}; $httpBackend.whenGET(`/api/tickets/1/getVolume`).respond(response);
$httpBackend.whenGET(`/api/tickets/1/getVolume`).respond(response); $httpBackend.expectGET(`/api/tickets/1/getVolume`);
$httpBackend.expectGET(`/api/tickets/1/getVolume`); controller.setVolumes();
controller.setVolumes(); $httpBackend.flush();
$httpBackend.flush();
expect($scope.index.model.instances[0].volume.m3).toBe(0.008); expect($scope.index.model.instances[0].volume.m3).toBe(0.008);
expect($scope.index.model.instances[1].volume.m3).toBe(0.003); expect($scope.index.model.instances[1].volume.m3).toBe(0.003);
});
}); });
}); });
}); });