2824-ticket_totalWith_and_without_VAT #571
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue