7152-devToTest_2414 #2228
|
@ -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');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
fdescribe('itemShelving return()', () => {
|
describe('itemShelving return()', () => {
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
ctx = {
|
ctx = {
|
||||||
accessToken: {userId: 9},
|
accessToken: {userId: 9},
|
||||||
|
@ -11,7 +11,8 @@ fdescribe('itemShelving return()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a list of items and alternative locations', async() => {
|
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].itemFk).toEqual(999997);
|
||||||
expect(itemShelvings[0].quantity).toEqual(10);
|
expect(itemShelvings[0].quantity).toEqual(10);
|
||||||
|
@ -19,13 +20,15 @@ fdescribe('itemShelving return()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a list of items without alternatives', async() => {
|
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);
|
expect(itemShelvings[0].carros.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an empty list', async() => {
|
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);
|
expect(itemShelvings.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,8 @@ describe('expeditonPallet getPallet()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should obtain the pallet data', async() => {
|
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).toBeDefined();
|
||||||
expect(pallet.truckFk).toEqual(1);
|
expect(pallet.truckFk).toEqual(1);
|
||||||
|
@ -20,8 +21,9 @@ describe('expeditonPallet getPallet()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when the pallet does not exist', async() => {
|
it('should throw an error when the pallet does not exist', async() => {
|
||||||
|
const palletId = 600;
|
||||||
try {
|
try {
|
||||||
await models.ExpeditionPallet.getPallet(ctx, 600);
|
await models.ExpeditionPallet.getPallet(ctx, palletId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const error = e;
|
const error = e;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue