2021-07-08 13:53:30 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2018-01-19 12:05:25 +00:00
|
|
|
|
2018-01-19 12:07:03 +00:00
|
|
|
describe('Greuge totalGreuge()', () => {
|
2018-04-03 14:10:39 +00:00
|
|
|
it('should call the sumAmount method', async() => {
|
2021-07-08 13:53:30 +00:00
|
|
|
const tx = await models.Client.beginTransaction({});
|
2018-01-19 12:05:25 +00:00
|
|
|
|
2021-07-08 13:53:30 +00:00
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
2018-01-23 08:33:23 +00:00
|
|
|
|
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();
|
|
|
|
}
|
2018-01-19 12:05:25 +00:00
|
|
|
});
|
|
|
|
});
|