salix/modules/client/back/methods/greuge/specs/sumAmount.spec.js

15 lines
450 B
JavaScript

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);
});
});