#235 getMana back unit test plus helpers setup
This commit is contained in:
parent
dafb554792
commit
9928521557
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -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);
|
||||
};
|
Loading…
Reference in New Issue