From 3e8b26c91e167c9914adcbd6e7ab19742cc26981 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 16 Apr 2018 11:21:13 +0200 Subject: [PATCH] #235 back end unit tests for getAverageInvoiced --- .../common/models/address-observation.json | 40 +++++++++---------- .../client/specs/getAverageInvoiced.spec.js | 18 +++++++++ 2 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 services/loopback/common/methods/client/specs/getAverageInvoiced.spec.js diff --git a/services/client/common/models/address-observation.json b/services/client/common/models/address-observation.json index 53b6155ec..147e19f07 100644 --- a/services/client/common/models/address-observation.json +++ b/services/client/common/models/address-observation.json @@ -8,27 +8,27 @@ } }, "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "description": { - "type": "string", - "required": true - } + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "string", + "required": true + } }, "relations": { - "address": { - "type": "belongsTo", - "model": "Address", - "foreignKey": "addressFk" - }, - "observationType": { - "type": "belongsTo", - "model": "ObservationType", - "foreignKey": "observationTypeFk" - } + "address": { + "type": "belongsTo", + "model": "Address", + "foreignKey": "addressFk" + }, + "observationType": { + "type": "belongsTo", + "model": "ObservationType", + "foreignKey": "observationTypeFk" + } } - } +} \ No newline at end of file diff --git a/services/loopback/common/methods/client/specs/getAverageInvoiced.spec.js b/services/loopback/common/methods/client/specs/getAverageInvoiced.spec.js new file mode 100644 index 000000000..46072461a --- /dev/null +++ b/services/loopback/common/methods/client/specs/getAverageInvoiced.spec.js @@ -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(); + }); + }); +});