25 lines
734 B
JavaScript
25 lines
734 B
JavaScript
const models = require('vn-loopback/server/server').models;
|
|
|
|
describe('entry getBuys()', () => {
|
|
const entryId = 4;
|
|
it('should get the buys and items of an entry', async() => {
|
|
const tx = await models.Entry.beginTransaction({});
|
|
const options = {transaction: tx};
|
|
|
|
try {
|
|
const result = await models.Entry.getBuys(entryId, options);
|
|
|
|
const length = result.length;
|
|
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
|
|
|
|
expect(result.length).toEqual(4);
|
|
expect(anyResult.item).toBeDefined();
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
throw e;
|
|
}
|
|
});
|
|
});
|