Updated unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-08-12 11:38:39 +02:00
parent b0df4973e9
commit de9d1268b7
2 changed files with 28 additions and 5 deletions

View File

@ -18,19 +18,19 @@ module.exports = Self => {
description: `If it's and integer searchs by id, otherwise it searchs by name`
}, {
arg: 'itemId',
type: 'Integer',
type: 'Number',
description: 'Item id'
}, {
arg: 'categoryId',
type: 'Integer',
type: 'Number',
description: 'Category id'
}, {
arg: 'typeId',
type: 'Integer',
type: 'Number',
description: 'Item type id',
}, {
arg: 'buyerId',
type: 'Integer',
type: 'Number',
description: 'Buyer id'
}, {
arg: 'from',
@ -121,6 +121,9 @@ module.exports = Self => {
stmt.merge(conn.makePagination(filter));
return conn.executeStmt(stmt);
console.log(stmt.sql);
console.log(stmt.params);
return await conn.executeStmt(stmt);
};
};

View File

@ -37,4 +37,24 @@ describe('client consumption() filter', () => {
expect(secondRow.quantity).toEqual(15);
expect(thirdRow.quantity).toEqual(20);
});
it('should return a list of tickets from the item id 4', async() => {
const ctx = {
args: {
itemId: 4
}
};
const filter = {
where: {
clientFk: 101
},
order: 'itemTypeFk, itemName, itemSize'
};
const result = await app.models.Client.consumption(ctx, filter);
const expectedItemId = 4;
const firstRow = result[0];
expect(firstRow.itemFk).toEqual(expectedItemId);
});
});