db connector: fix tests
This commit is contained in:
@@ -15,7 +15,7 @@ describe('DBConnector', () => {
|
||||
};
|
||||
});
|
||||
|
||||
it('should load datasource by name by default', () => {
|
||||
it('should try to load datasource by name first', () => {
|
||||
ctx.options = {
|
||||
datasourceName: 'bar'
|
||||
};
|
||||
@@ -35,13 +35,13 @@ describe('DBConnector', () => {
|
||||
it('should throw error if no name and id specified', () => {
|
||||
ctx.options = {};
|
||||
const dbConnector = new DBConnector(ctx.options, datasourceSrv);
|
||||
return expect(dbConnector.loadDBDataSource()).rejects.toBe('SQL Data Source name should be specified');
|
||||
return expect(dbConnector.loadDBDataSource()).rejects.toBe('Data Source name should be specified');
|
||||
});
|
||||
|
||||
it('should throw error if datasource with given id is not found', () => {
|
||||
ctx.options.datasourceId = 45;
|
||||
const dbConnector = new DBConnector(ctx.options, datasourceSrv);
|
||||
return expect(dbConnector.loadDBDataSource()).rejects.toBe('SQL Data Source with ID 45 not found');
|
||||
return expect(dbConnector.loadDBDataSource()).rejects.toBe('Data Source with ID 45 not found');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,7 +113,6 @@ export class SQLConnector extends DBConnector {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function compactSQLQuery(query) {
|
||||
return query.replace(/\s+/g, ' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user