loopback/test/remote-connector.test.js

30 lines
816 B
JavaScript
Raw Normal View History

var loopback = require('../');
var defineModelTestsWithDataSource = require('./util/model-tests');
describe('RemoteConnector', function() {
var remoteApp;
var remote;
defineModelTestsWithDataSource({
beforeEach: function(done) {
var test = this;
remoteApp = loopback();
remoteApp.use(loopback.logger('dev'));
remoteApp.use(loopback.rest());
remoteApp.listen(0, function() {
test.dataSource = loopback.createDataSource({
host: remoteApp.get('host'),
port: remoteApp.get('port'),
connector: loopback.Remote
});
done();
});
},
onDefine: function(Model) {
var RemoteModel = Model.extend(Model.modelName);
RemoteModel.attachTo(loopback.memory());
remoteApp.model(RemoteModel);
}
});
});