greuge backend unit tests for filter and totalGreuge finished

This commit is contained in:
Carlos Jimenez 2018-01-19 13:05:25 +01:00
parent a60d8f120c
commit 072f02aacb
3 changed files with 16 additions and 4 deletions

View File

@ -2,8 +2,6 @@ import app from '../../../../server/server';
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
import {restoreFixtures} from '../../../../../../services/db/testing_fixtures';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Client Create()', () => {
beforeEach(() => {
restoreFixtures();

View File

@ -1,7 +1,5 @@
import filter from '../filter';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('Greuge filter', () => {
it('should call the filterParams method', () => {
let params = {

View File

@ -0,0 +1,16 @@
import totalGreuge from '../totalGreuge';
describe('Greuge filter', () => {
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);
});
});