#235 back end unit tests for getAverageInvoiced

This commit is contained in:
Carlos Jimenez 2018-04-16 11:21:13 +02:00
parent 5550b9cbba
commit 3e8b26c91e
2 changed files with 38 additions and 20 deletions

View File

@ -8,27 +8,27 @@
} }
}, },
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "Number",
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"description": { "description": {
"type": "string", "type": "string",
"required": true "required": true
} }
}, },
"relations": { "relations": {
"address": { "address": {
"type": "belongsTo", "type": "belongsTo",
"model": "Address", "model": "Address",
"foreignKey": "addressFk" "foreignKey": "addressFk"
}, },
"observationType": { "observationType": {
"type": "belongsTo", "type": "belongsTo",
"model": "ObservationType", "model": "ObservationType",
"foreignKey": "observationTypeFk" "foreignKey": "observationTypeFk"
} }
} }
} }

View File

@ -0,0 +1,18 @@
const getAverageInvoiced = require('../getAverageInvoiced');
const {rawSql} = require('./helpers');
const model = {
remoteMethod: () => {}
};
rawSql(model);
getAverageInvoiced(model);
describe('client getAverageInvoiced()', () => {
it('should call the getAverageInvoiced method', done => {
model.getAverageInvoiced(101)
.then(response => {
expect(response.invoiced).toEqual(0);
done();
});
});
});