20 lines
665 B
JavaScript
20 lines
665 B
JavaScript
const totalGreuge = require('../sumAmount');
|
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
|
|
|
describe('Greuge totalGreuge()', () => {
|
|
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 = (error, result) => {
|
|
if (error) return catchErrors(done)(error);
|
|
|
|
expect(result).toBe(6000);
|
|
done();
|
|
};
|
|
self.sumAmount(clientFk, callback);
|
|
});
|
|
});
|