fix: refs #6276 item_card & wip test
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-01-18 14:35:51 +01:00
parent 19edd7868e
commit b33594e0da
2 changed files with 15 additions and 4 deletions

View File

@ -30,14 +30,13 @@ module.exports = Self => {
const [result] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); const [result] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]);
const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]); const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]);
const realIdItems = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); const [realIdItem] = barcodeItems.map(barcodeItem => barcodeItem.realIdItem);
const barcodes = await models.ItemBarcode.find({ const barcodes = await models.ItemBarcode.find({
fields: ['code'], fields: ['code'],
where: { where: {
realIdItem: { itemFk: realIdItem
inq: realIdItems
}
} }
}); });

View File

@ -0,0 +1,12 @@
const {models} = require('vn-loopback/server/server');
fdescribe('item card()', () => {
const itemFk = 1;
const warehouseFk = 1;
it('WIP: should get something', async() => {
const card = await models.Item.card(itemFk, warehouseFk);
expect(card).toBeDefined();
expect(card.barcodes);
});
});