2018-01-31 12:40:26 +00:00
|
|
|
const totalGreuge = require('../sumAmount');
|
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() => {
|
2018-01-19 12:05:25 +00:00
|
|
|
let clientFk = 1;
|
|
|
|
let self = jasmine.createSpyObj('self', ['remoteMethod', 'rawSql']);
|
|
|
|
self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}]));
|
|
|
|
totalGreuge(self);
|
|
|
|
|
2018-04-03 14:10:39 +00:00
|
|
|
let result = await self.sumAmount(clientFk);
|
2018-01-23 08:33:23 +00:00
|
|
|
|
2018-04-03 14:10:39 +00:00
|
|
|
expect(result).toBe(6000);
|
2018-01-19 12:05:25 +00:00
|
|
|
});
|
|
|
|
});
|