diff --git a/modules/item/back/methods/item-barcode/specs/delete.spec.js b/modules/item/back/methods/item-barcode/specs/delete.spec.js new file mode 100644 index 000000000..56377eb78 --- /dev/null +++ b/modules/item/back/methods/item-barcode/specs/delete.spec.js @@ -0,0 +1,22 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('itemBarcode delete()', () => { + it('should delete a record by itemFk and code', async() => { + const tx = await models.ItemBarcode.beginTransaction({}); + const options = {transaction: tx}; + const itemFk = 1; + const code = 1111111111; + + try { + const itemsBarcodeBefore = await models.ItemBarcode.find({}, options); + await models.ItemBarcode.delete(code, itemFk, options); + const itemsBarcodeAfter = await models.ItemBarcode.find({}, options); + + expect(itemsBarcodeBefore.length).toBeGreaterThan(itemsBarcodeAfter.length); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index 996491992..e5ed0aa85 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('itemShelving return()', () => { +describe('itemShelving return()', () => { beforeAll(async() => { ctx = { accessToken: {userId: 9}, @@ -11,7 +11,8 @@ fdescribe('itemShelving return()', () => { }); it('should return a list of items and alternative locations', async() => { - const itemShelvings = await models.ItemShelving.return('PCC'); + const shelvingFk = 'PCC'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings[0].itemFk).toEqual(999997); expect(itemShelvings[0].quantity).toEqual(10); @@ -19,13 +20,15 @@ fdescribe('itemShelving return()', () => { }); it('should return a list of items without alternatives', async() => { - const itemShelvings = await models.ItemShelving.return('HEJ'); + const shelvingFk = 'HEJ'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings[0].carros.length).toEqual(0); }); it('should return an empty list', async() => { - const itemShelvings = await models.ItemShelving.return('ZZP'); + const shelvingFk = 'ZZP'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings.length).toEqual(0); }); diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js index 84bb9f93a..2fc79d459 100644 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -12,7 +12,8 @@ describe('expeditonPallet getPallet()', () => { }); it('should obtain the pallet data', async() => { - const pallet = await models.ExpeditionPallet.getPallet(ctx, 1); + const palletId = 1; + const pallet = await models.ExpeditionPallet.getPallet(ctx, palletId); expect(pallet).toBeDefined(); expect(pallet.truckFk).toEqual(1); @@ -20,8 +21,9 @@ describe('expeditonPallet getPallet()', () => { }); it('should throw an error when the pallet does not exist', async() => { + const palletId = 600; try { - await models.ExpeditionPallet.getPallet(ctx, 600); + await models.ExpeditionPallet.getPallet(ctx, palletId); } catch (e) { const error = e;