salix/modules/client/back/methods/greuge/specs/sumAmount.spec.js

22 lines
543 B
JavaScript
Raw Normal View History

2021-07-08 13:53:30 +00:00
const models = require('vn-loopback/server/server').models;
2018-01-19 12:07:03 +00:00
describe('Greuge totalGreuge()', () => {
it('should call the sumAmount method', async() => {
2021-07-08 13:53:30 +00:00
const tx = await models.Client.beginTransaction({});
2021-07-08 13:53:30 +00:00
try {
const options = {transaction: tx};
2021-07-08 13:53:30 +00:00
const clientId = 1;
const result = await models.Client.sumAmount(clientId, options);
expect(result).toBe(6000);
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});