Updated unit tests
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
e6b60d73f1
commit
e641a947b3
|
@ -30,7 +30,7 @@ export default class Popover extends Popup {
|
|||
|
||||
if (parent) this.parent = parent;
|
||||
if (direction) this.direction = direction;
|
||||
console.log(direction);
|
||||
|
||||
super.show();
|
||||
this.content = this.popup.querySelector('.content');
|
||||
this.$timeout(() => this.relocate(), 10);
|
||||
|
@ -60,7 +60,6 @@ export default class Popover extends Popup {
|
|||
* Repositions the popover to a correct location relative to the parent.
|
||||
*/
|
||||
relocate() {
|
||||
console.log(this.direction);
|
||||
if (!(this.parent && this._shown && this.displayMode == 'relative'))
|
||||
return;
|
||||
|
||||
|
|
|
@ -138,6 +138,42 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('showCsvDeliveryNote()', () => {
|
||||
it('should make a query to the csv delivery-note download endpoint and show a message snackbar', () => {
|
||||
jest.spyOn(window, 'open').mockReturnThis();
|
||||
|
||||
const expectedParams = {
|
||||
ticketId: ticket.id,
|
||||
recipientId: ticket.client.id
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(expectedParams);
|
||||
const expectedPath = `api/csv/delivery-note/download?${serializedParams}`;
|
||||
controller.showCsvDeliveryNote();
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith(expectedPath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sendCsvDeliveryNote()', () => {
|
||||
it('should make a query to the csv delivery-note send endpoint and show a message snackbar', () => {
|
||||
jest.spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
const $data = {email: 'brucebanner@gothamcity.com'};
|
||||
const expectedParams = {
|
||||
ticketId: ticket.id,
|
||||
recipient: $data.email,
|
||||
recipientId: ticket.client.id,
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(expectedParams);
|
||||
|
||||
$httpBackend.expectGET(`csv/delivery-note/send?${serializedParams}`).respond();
|
||||
controller.sendCsvDeliveryNote($data);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showMessage).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeInvoice()', () => {
|
||||
it('should make a query and call $state.reload() method', () => {
|
||||
jest.spyOn(controller, 'reload').mockReturnThis();
|
||||
|
@ -226,66 +262,4 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('showCsvInvoice()', () => {
|
||||
it('should make a query to the csv invoice download endpoint and show a message snackbar', () => {
|
||||
jest.spyOn(window, 'open').mockReturnThis();
|
||||
|
||||
controller.invoiceOut = invoiceOut;
|
||||
|
||||
const expectedParams = {
|
||||
invoiceId: invoiceOut.id,
|
||||
recipientId: invoiceOut.client.id
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(expectedParams);
|
||||
const expectedPath = `api/csv/invoice/download?${serializedParams}`;
|
||||
controller.showCsvInvoice();
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith(expectedPath);
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('sendPdfInvoice()', () => {
|
||||
it('should make a query to the email invoice endpoint and show a message snackbar', () => {
|
||||
jest.spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
controller.invoiceOut = invoiceOut;
|
||||
|
||||
const $data = {email: 'brucebanner@gothamcity.com'};
|
||||
const expectedParams = {
|
||||
invoiceId: invoiceOut.id,
|
||||
recipient: $data.email,
|
||||
recipientId: invoiceOut.client.id
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(expectedParams);
|
||||
|
||||
$httpBackend.expectGET(`email/invoice?${serializedParams}`).respond();
|
||||
controller.sendPdfInvoice($data);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showMessage).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('sendCsvInvoice()', () => {
|
||||
it('should make a query to the csv invoice send endpoint and show a message snackbar', () => {
|
||||
jest.spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
controller.invoiceOut = invoiceOut;
|
||||
|
||||
const $data = {email: 'brucebanner@gothamcity.com'};
|
||||
const expectedParams = {
|
||||
invoiceId: invoiceOut.id,
|
||||
recipient: $data.email,
|
||||
recipientId: invoiceOut.client.id
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(expectedParams);
|
||||
|
||||
$httpBackend.expectGET(`csv/invoice/send?${serializedParams}`).respond();
|
||||
controller.sendCsvInvoice($data);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showMessage).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -95,7 +95,6 @@ module.exports = {
|
|||
},
|
||||
ticketSubtotal(ticket) {
|
||||
let subTotal = 0.00;
|
||||
console.log(ticket.sales);
|
||||
for (let sale of ticket.sales)
|
||||
subTotal += this.saleImport(sale);
|
||||
|
||||
|
|
Loading…
Reference in New Issue