refactor ticket_sale
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-12-01 11:39:48 +01:00
parent 77191b6182
commit 75e32feb16
3 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,7 @@ module.exports = Self => {
http: {source: 'body'}
}],
returns: {
type: 'Number',
type: 'number',
root: true
},
http: {

View File

@ -453,9 +453,8 @@ class Controller extends Section {
const sales = this.selectedValidSales();
if (!sales) return;
const params = sales;
const query = `Sales/recalculatePrice`;
this.$http.post(query, params).then(() => {
this.$http.post(query, sales).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh();
});

View File

@ -684,14 +684,13 @@ describe('Ticket', () => {
});
describe('calculateSalePrice()', () => {
it('should make an HTTP post query ', () => {
it('should make an HTTP post query', () => {
jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
jest.spyOn(controller.$.model, 'refresh').mockReturnThis();
const selectedSaleOne = controller.sales[0];
const selectedSaleTwo = controller.sales[1];
selectedSaleOne.checked = true;
selectedSaleTwo.checked = true;
controller.sales.forEach(sale => {
sale.checked = true;
});
$httpBackend.expect('POST', `Sales/recalculatePrice`).respond(200);
controller.calculateSalePrice();