2018-01-31 11:02:35 +00:00
|
|
|
const totalGreuge = require('../total');
|
|
|
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
2018-01-19 12:05:25 +00:00
|
|
|
|
2018-01-19 12:07:03 +00:00
|
|
|
describe('Greuge totalGreuge()', () => {
|
2018-01-19 12:05:25 +00:00
|
|
|
it('should call the sumAmount method', done => {
|
|
|
|
let clientFk = 1;
|
|
|
|
let self = jasmine.createSpyObj('self', ['remoteMethod', 'rawSql']);
|
|
|
|
self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}]));
|
|
|
|
totalGreuge(self);
|
|
|
|
|
2018-01-23 08:33:23 +00:00
|
|
|
let callback = (error, result) => {
|
|
|
|
if (error) return catchErrors(done)(error);
|
|
|
|
|
2018-01-19 12:05:25 +00:00
|
|
|
expect(result).toBe(6000);
|
|
|
|
done();
|
|
|
|
};
|
|
|
|
self.sumAmount(clientFk, callback);
|
|
|
|
});
|
|
|
|
});
|