feat: refs #6276 test itemBarcode_delete
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c0398d17bf
commit
8e5be5f5da
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue