Add forgotten unit test

The test should have been added as part of #859

[Back-port pull request #862]
This commit is contained in:
Miroslav Bajtoš 2016-03-02 12:32:11 +01:00
parent 0d11186850
commit 96a9759d6d
1 changed files with 21 additions and 0 deletions

21
test/datasource.test.js Normal file
View File

@ -0,0 +1,21 @@
var should = require('./init.js');
var DataSource = require('../lib/datasource.js').DataSource;
describe('DataSource', function() {
it('reports helpful error when connector init throws', function() {
var throwingConnector = {
name: 'loopback-connector-throwing',
initialize: function(ds, cb) {
throw new Error('expected test error');
},
};
(function() {
// this is what LoopBack does
return new DataSource({
name: 'dsname',
connector: throwingConnector
});
}).should.throw(/loopback-connector-throwing/);
});
});