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

23 lines
569 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-08-12 08:55:04 +00:00
const clientId = 1101;
2021-07-08 13:53:30 +00:00
2021-08-12 08:55:04 +00:00
const result = await models.Greuge.sumAmount(clientId, options);
2021-07-08 13:53:30 +00:00
2021-08-12 08:55:04 +00:00
expect(result).toBe(203.71);
2021-07-08 13:53:30 +00:00
await tx.rollback();
} catch (e) {
await tx.rollback();
2021-08-12 08:55:04 +00:00
throw e;
2021-07-08 13:53:30 +00:00
}
});
});