mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Webpack (#9391)
* webpack poc, this is not going to work for plugins, dam * tech: webpack and systemjs for plugins starting to work * tech: webpack and systemjs combo starting to work * tech: webpack + karma tests progress * tech: webpack + karma progress * tech: working on tests * tech: webpack * tech: webpack + karma, all tests pass * tech: webpack + karma, all tests pass * tech: webpack all tests pass * webpack: getting closer * tech: webpack progress * webpack: further build refinements * webpack: ng annotate fixes * webpack: optimized build fix * tech: minor fix for elasticsearch * tech: webpack + ace editor * tech: restored lodash move mixin compatability * tech: added enzyme react test and upgraded to react v16 * tech: package version fix * tech: added testdata to built in bundle * webpack: sass progress * tech: prod & dev build is working for the sass * tech: clean up unused grunt stuff and moved to scripts folder * tech: added vendor and manifest chunks, updated readme and docs * tech: webpack finishing touches
This commit is contained in:
60
public/app/features/plugins/specs/datasource_srv_specs.ts
Normal file
60
public/app/features/plugins/specs/datasource_srv_specs.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
|
||||
import config from 'app/core/config';
|
||||
import 'app/features/plugins/datasource_srv';
|
||||
|
||||
describe('datasource_srv', function() {
|
||||
var _datasourceSrv;
|
||||
var metricSources;
|
||||
var templateSrv = {};
|
||||
|
||||
beforeEach(angularMocks.module('grafana.core'));
|
||||
beforeEach(angularMocks.module(function($provide) {
|
||||
$provide.value('templateSrv', templateSrv);
|
||||
}));
|
||||
beforeEach(angularMocks.module('grafana.services'));
|
||||
beforeEach(angularMocks.inject(function(datasourceSrv) {
|
||||
_datasourceSrv = datasourceSrv;
|
||||
}));
|
||||
|
||||
describe('when loading metric sources', function() {
|
||||
var unsortedDatasources = {
|
||||
'mmm': {
|
||||
type: 'test-db',
|
||||
meta: { metrics: {m: 1} }
|
||||
},
|
||||
'--Grafana--': {
|
||||
type: 'grafana',
|
||||
meta: {builtIn: true, metrics: {m: 1}, id: "grafana"}
|
||||
},
|
||||
'--Mixed--': {
|
||||
type: 'test-db',
|
||||
meta: {builtIn: true, metrics: {m: 1}, id: "mixed"}
|
||||
},
|
||||
'ZZZ': {
|
||||
type: 'test-db',
|
||||
meta: {metrics: {m: 1} }
|
||||
},
|
||||
'aaa': {
|
||||
type: 'test-db',
|
||||
meta: { metrics: {m: 1} }
|
||||
},
|
||||
'BBB': {
|
||||
type: 'test-db',
|
||||
meta: { metrics: {m: 1} }
|
||||
},
|
||||
};
|
||||
beforeEach(function() {
|
||||
config.datasources = unsortedDatasources;
|
||||
metricSources = _datasourceSrv.getMetricSources({skipVariables: true});
|
||||
});
|
||||
|
||||
it('should return a list of sources sorted case insensitively with builtin sources last', function() {
|
||||
expect(metricSources[0].name).to.be('aaa');
|
||||
expect(metricSources[1].name).to.be('BBB');
|
||||
expect(metricSources[2].name).to.be('mmm');
|
||||
expect(metricSources[3].name).to.be('ZZZ');
|
||||
expect(metricSources[4].name).to.be('--Grafana--');
|
||||
expect(metricSources[5].name).to.be('--Mixed--');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user