salix/modules/item/back/methods/item-barcode/specs/delete.spec.js

23 lines
799 B
JavaScript
Raw Normal View History

2024-03-14 07:36:19 +00:00
const {models} = require('vn-loopback/server/server');
describe('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;
}
});
});