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'}
|
||||
}],
|
||||
returns: {
|
||||
type: 'Number',
|
||||
type: 'number',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue