db connector: fix tests

This commit is contained in:
Alexander Zobnin
2018-10-30 21:48:39 +03:00
parent 6af18e493e
commit 42839648c4
2 changed files with 3 additions and 4 deletions

View File

@@ -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 = { ctx.options = {
datasourceName: 'bar' datasourceName: 'bar'
}; };
@@ -35,13 +35,13 @@ describe('DBConnector', () => {
it('should throw error if no name and id specified', () => { it('should throw error if no name and id specified', () => {
ctx.options = {}; ctx.options = {};
const dbConnector = new DBConnector(ctx.options, datasourceSrv); 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', () => { it('should throw error if datasource with given id is not found', () => {
ctx.options.datasourceId = 45; ctx.options.datasourceId = 45;
const dbConnector = new DBConnector(ctx.options, datasourceSrv); 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');
}); });
}); });
}); });

View File

@@ -113,7 +113,6 @@ export class SQLConnector extends DBConnector {
} }
} }
function compactSQLQuery(query) { function compactSQLQuery(query) {
return query.replace(/\s+/g, ' '); return query.replace(/\s+/g, ' ');
} }