ticket.sale front unit test fix
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
4c0d583556
commit
05ee2ee2d3
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue