27 lines
866 B
JavaScript
27 lines
866 B
JavaScript
const models = require('vn-loopback/server/server').models;
|
|
|
|
describe('item getSummary()', () => {
|
|
it('should return summary with item, tags, botanical, available and visible defined ', async() => {
|
|
const tx = await models.Item.beginTransaction({});
|
|
const options = {transaction: tx};
|
|
|
|
try {
|
|
const ctx = {req: {accessToken: {userId: 1}}};
|
|
|
|
const result = await models.Item.getSummary(ctx, 1, options);
|
|
const keys = Object.keys(result);
|
|
|
|
expect(keys).toContain('item');
|
|
expect(keys).toContain('tags');
|
|
expect(keys).toContain('botanical');
|
|
expect(keys).toContain('available');
|
|
expect(keys).toContain('visible');
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
throw e;
|
|
}
|
|
});
|
|
});
|