2824-ticket_totalWith_and_without_VAT #571

Merged
carlosjr merged 4 commits from 2824-ticket_totalWith_and_without_VAT into dev 2021-03-11 16:08:48 +00:00
1 changed files with 8 additions and 6 deletions
Showing only changes of commit 05ee2ee2d3 - Show all commits

View File

@ -84,13 +84,13 @@ describe('Ticket', () => {
describe('getSubTotal()', () => { describe('getSubTotal()', () => {
it('should make an HTTP GET query and then set the subtotal property', () => { it('should make an HTTP GET query and then set the subtotal property', () => {
const expectedAmount = 128; const expectedResponse = {totalWithoutVat: 128};
$httpBackend.expect('GET', 'Tickets/1/subtotal').respond(200, expectedAmount); $httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse);
controller.getSubTotal(); controller.getSubTotal();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.subtotal).toEqual(expectedAmount); expect(controller.subtotal).toEqual(expectedResponse.totalWithoutVat);
}); });
}); });
@ -125,13 +125,15 @@ describe('Ticket', () => {
describe('getVat()', () => { describe('getVat()', () => {
it('should make an HTTP GET query and return the ticket VAT', () => { it('should make an HTTP GET query and return the ticket VAT', () => {
controller.edit = {}; controller.edit = {};
const expectedAmount = 67; const expectedResponse = {totalWithVat: 1000, totalWithoutVat: 999};
$httpBackend.expect('GET', 'Tickets/1/getVAT').respond(200, expectedAmount); const expectedVAT = expectedResponse.totalWithVat - expectedResponse.totalWithoutVat;
$httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse);
controller.getVat(); controller.getVat();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.VAT).toEqual(expectedAmount); expect(controller.VAT).toEqual(expectedVAT);
}); });
}); });