total greuge backend unit test error handling added

This commit is contained in:
Carlos Jimenez 2018-01-23 09:33:23 +01:00
parent 5341c5bbf1
commit f8736bc599
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import totalGreuge from '../totalGreuge';
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
describe('Greuge totalGreuge()', () => {
it('should call the sumAmount method', done => {
@ -7,7 +8,9 @@ describe('Greuge totalGreuge()', () => {
self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}]));
totalGreuge(self);
let callback = (err, result) => {
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
expect(result).toBe(6000);
done();
};