2018-04-17 12:49:55 +00:00
|
|
|
const getTotal = require('../get-total');
|
|
|
|
const model = {
|
|
|
|
remoteMethod: () => {}
|
|
|
|
};
|
2018-04-18 12:37:17 +00:00
|
|
|
let Loopback = require('../../../test-helpers/loopback');
|
|
|
|
Loopback.init(model);
|
2018-04-17 12:49:55 +00:00
|
|
|
|
2018-04-18 12:37:17 +00:00
|
|
|
Loopback.rawSql(model);
|
2018-04-17 12:49:55 +00:00
|
|
|
getTotal(model);
|
|
|
|
|
|
|
|
describe('ticket getTotal()', () => {
|
|
|
|
it('should call the getTotal method and return the response', done => {
|
|
|
|
model.getTotal(1)
|
|
|
|
.then(response => {
|
|
|
|
expect(response).toEqual(11.55);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should call the getTotal method and return zero if doesn't have lines`, done => {
|
|
|
|
model.getTotal(13)
|
|
|
|
.then(response => {
|
|
|
|
expect(response).toEqual(0);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|