diff --git a/services/order/common/methods/order/getVolumes.js b/services/order/common/methods/order/getVolumes.js index f7583f425..de3f87912 100644 --- a/services/order/common/methods/order/getVolumes.js +++ b/services/order/common/methods/order/getVolumes.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('getVolume', { + Self.remoteMethod('getVolumes', { description: 'Returns the volumes of a order', accessType: 'READ', accepts: [{ @@ -18,7 +18,7 @@ module.exports = Self => { } }); - Self.getVolume = async orderFk => { + Self.getVolumes = async orderFk => { let [volume] = await Self.rawSql(`CALL vn.orderListVolume(?)`, [orderFk]); return volume; }; diff --git a/services/order/common/methods/order/specs/getVolumes.spec.js b/services/order/common/methods/order/specs/getVolumes.spec.js new file mode 100644 index 000000000..39f9eaa49 --- /dev/null +++ b/services/order/common/methods/order/specs/getVolumes.spec.js @@ -0,0 +1,9 @@ +const app = require(`../../../../server/server`); + +describe('order getVolumes()', () => { + it('should return the volumes of a given order id', async() => { + let [result] = await app.models.Order.getVolumes(1); + + expect(result.volume).toEqual(0.072); + }); +});