2021-07-12 10:54:59 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2019-02-22 07:32:18 +00:00
|
|
|
|
|
|
|
describe('item-barcode toItem()', () => {
|
|
|
|
it('should return the same number if there is a barcode and a item with the same ID', async() => {
|
2021-07-12 10:54:59 +00:00
|
|
|
const tx = await models.Item.beginTransaction({});
|
|
|
|
const options = {transaction: tx};
|
2019-02-22 07:32:18 +00:00
|
|
|
|
2021-07-12 10:54:59 +00:00
|
|
|
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;
|
|
|
|
}
|
2019-02-22 07:32:18 +00:00
|
|
|
});
|
|
|
|
});
|