const totalGreuge = require('../sumAmount'); describe('Greuge totalGreuge()', () => { it('should call the sumAmount method', async() => { let clientFk = 1; let self = jasmine.createSpyObj('self', ['remoteMethod', 'rawSql']); self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}])); totalGreuge(self); let result = await self.sumAmount(clientFk); expect(result).toBe(6000); }); });