2018-01-19 12:05:25 +00:00
|
|
|
import totalGreuge from '../totalGreuge';
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
let callback = (err, result) => {
|
|
|
|
expect(result).toBe(6000);
|
|
|
|
done();
|
|
|
|
};
|
|
|
|
self.sumAmount(clientFk, callback);
|
|
|
|
});
|
|
|
|
});
|