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

21 lines
601 B
JavaScript

const models = require('vn-loopback/server/server').models;
describe('item-barcode toItem()', () => {
it('should return the same number if there is a barcode and a item with the same ID', async() => {
const tx = await models.Item.beginTransaction({});
const options = {transaction: tx};
try {
const barcode = 3;
const result = await models.ItemBarcode.toItem(barcode, options);
expect(result).toBe(3);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});