diff --git a/services/loopback/common/methods/client/specs/getMana.spec.js b/services/loopback/common/methods/client/specs/getMana.spec.js new file mode 100644 index 000000000..f9b634c62 --- /dev/null +++ b/services/loopback/common/methods/client/specs/getMana.spec.js @@ -0,0 +1,19 @@ +const getMana = require('../getMana'); +const {rawSql} = require('./helpers'); +const model = { + remoteMethod: () => {} +}; + +rawSql(model); +getMana(model); + +describe('client getMana()', () => { + it('should call the getMana method', done => { + model.getMana(101) + .then(response => { + expect(response.mana).toEqual(0); + done(); + }); + }); +}); + diff --git a/services/loopback/common/methods/client/specs/helpers.js b/services/loopback/common/methods/client/specs/helpers.js new file mode 100644 index 000000000..56034b206 --- /dev/null +++ b/services/loopback/common/methods/client/specs/helpers.js @@ -0,0 +1,14 @@ +module.exports.rawSql = Self => { + const DataSource = require('loopback-datasource-juggler').DataSource; + const rawSql = require('../../../../common/methods/vnModel/rawSql.js'); + const dataSourceConfig = { + connector: 'mysql', + host: 'localhost', + user: 'root', + password: 'root', + database: 'salix' + }; + const dataSource = new DataSource(dataSourceConfig); + Self.dataSource = dataSource; + rawSql(Self); +};