33 lines
1022 B
JavaScript
33 lines
1022 B
JavaScript
const app = require('vn-loopback/server/server');
|
|
|
|
describe('claim getSummary()', () => {
|
|
it('should return summary with claim, salesClaimed, developments and actions defined ', async() => {
|
|
const tx = await app.models.Claim.beginTransaction({});
|
|
const ctx = {
|
|
req: {
|
|
accessToken: {
|
|
userId: 9
|
|
}
|
|
}
|
|
};
|
|
try {
|
|
const options = {transaction: tx};
|
|
|
|
const result = await app.models.Claim.getSummary(ctx, 1, options);
|
|
const keys = Object.keys(result);
|
|
|
|
expect(keys).toContain('claim');
|
|
expect(keys).toContain('salesClaimed');
|
|
expect(keys).toContain('developments');
|
|
expect(keys).toContain('observations');
|
|
expect(keys).toContain('actions');
|
|
expect(keys).toContain('isEditable');
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
throw e;
|
|
}
|
|
});
|
|
});
|