fix test
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-04-12 11:57:56 +02:00
parent e1de41f801
commit 4872407723
4 changed files with 22 additions and 17 deletions

View File

@ -725,7 +725,7 @@ export default {
claimAction: {
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
anyLine: 'vn-claim-action vn-tbody > vn-tr',
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
firstDeleteLine: 'vn-claim-action tr:nth-child(1) vn-icon-button[icon="delete"]',
isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]'
},
ordersIndex: {

View File

@ -37,17 +37,6 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {'i.id': value}
: {'i.name': {like: `%${value}%`}};
}
});
filter = mergeFilters(filter, {where});
const stmts = [];
const stmt = new ParameterizedSQL(

View File

@ -87,7 +87,7 @@
</td>
<td number>
<vn-span
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk)"
ng-click="itemDescriptor.show($event, saleClaimed.itemFk)"
class="link">
{{::saleClaimed.itemFk | zeroFill:6}}
</vn-span>
@ -95,7 +95,7 @@
<td number>
<vn-span
class="link"
ng-click="ticketDescriptor.show($event, saleClaimed.sale.ticketFk)">
ng-click="ticketDescriptor.show($event, saleClaimed.ticketFk)">
{{::saleClaimed.ticketFk}}
</vn-span>
</td>

View File

@ -43,9 +43,9 @@ describe('claim', () => {
describe('calculateTotals()', () => {
it('should calculate the total price of the items claimed', () => {
controller.salesClaimed = [
{sale: {quantity: 5, price: 2, discount: 0}},
{sale: {quantity: 10, price: 2, discount: 0}},
{sale: {quantity: 10, price: 2, discount: 0}}
{quantity: 5, price: 2, discount: 0},
{quantity: 10, price: 2, discount: 0},
{quantity: 10, price: 2, discount: 0}
];
controller.calculateTotals();
@ -151,5 +151,21 @@ describe('claim', () => {
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Greuge added');
});
});
describe('onResponse()', () => {
it('should perform a post query and show a success message', () => {
jest.spyOn(controller.vnApp, 'showSuccess');
const data = {
rows: {id: 1},
claimDestinationFk: 1
};
$httpBackend.expect('POST', `Claims/updateClaimDestination`, data).respond({});
controller.save(data);
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
});
});