refactor ticket_sale
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
77191b6182
commit
75e32feb16
|
@ -11,7 +11,7 @@ module.exports = Self => {
|
||||||
http: {source: 'body'}
|
http: {source: 'body'}
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'Number',
|
type: 'number',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
|
|
@ -453,9 +453,8 @@ class Controller extends Section {
|
||||||
const sales = this.selectedValidSales();
|
const sales = this.selectedValidSales();
|
||||||
if (!sales) return;
|
if (!sales) return;
|
||||||
|
|
||||||
const params = sales;
|
|
||||||
const query = `Sales/recalculatePrice`;
|
const query = `Sales/recalculatePrice`;
|
||||||
this.$http.post(query, params).then(() => {
|
this.$http.post(query, sales).then(() => {
|
||||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
this.$.model.refresh();
|
this.$.model.refresh();
|
||||||
});
|
});
|
||||||
|
|
|
@ -684,14 +684,13 @@ describe('Ticket', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('calculateSalePrice()', () => {
|
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.vnApp, 'showSuccess').mockReturnThis();
|
||||||
jest.spyOn(controller.$.model, 'refresh').mockReturnThis();
|
jest.spyOn(controller.$.model, 'refresh').mockReturnThis();
|
||||||
|
|
||||||
const selectedSaleOne = controller.sales[0];
|
controller.sales.forEach(sale => {
|
||||||
const selectedSaleTwo = controller.sales[1];
|
sale.checked = true;
|
||||||
selectedSaleOne.checked = true;
|
});
|
||||||
selectedSaleTwo.checked = true;
|
|
||||||
|
|
||||||
$httpBackend.expect('POST', `Sales/recalculatePrice`).respond(200);
|
$httpBackend.expect('POST', `Sales/recalculatePrice`).respond(200);
|
||||||
controller.calculateSalePrice();
|
controller.calculateSalePrice();
|
||||||
|
|
Loading…
Reference in New Issue