ticket.sale front unit test fix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-03-11 10:44:34 +01:00
parent 4c0d583556
commit 05ee2ee2d3
1 changed files with 8 additions and 6 deletions

View File

@ -84,13 +84,13 @@ describe('Ticket', () => {
describe('getSubTotal()', () => {
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();
$httpBackend.flush();
expect(controller.subtotal).toEqual(expectedAmount);
expect(controller.subtotal).toEqual(expectedResponse.totalWithoutVat);
});
});
@ -125,13 +125,15 @@ describe('Ticket', () => {
describe('getVat()', () => {
it('should make an HTTP GET query and return the ticket VAT', () => {
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();
$httpBackend.flush();
expect(controller.VAT).toEqual(expectedAmount);
expect(controller.VAT).toEqual(expectedVAT);
});
});