mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
more work on filterSrv unit tests
This commit is contained in:
committed by
Bruce Sherrod
parent
517ac3f111
commit
d8cf427425
@@ -28,7 +28,7 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe.only('filterOptionSelected', function() {
|
||||
describe('filterOptionSelected', function() {
|
||||
beforeEach(function() {
|
||||
_filterSrv.add({ name: 'test' });
|
||||
_filterSrv.filterOptionSelected(_filterSrv.list[0], { value: 'muuuu' });
|
||||
|
||||
@@ -4,7 +4,7 @@ define([
|
||||
'services/filterSrv'
|
||||
], function(dashboardMock, _) {
|
||||
|
||||
describe('filterSrv', function() {
|
||||
describe('graphiteTargetCtrl', function() {
|
||||
var _filterSrv;
|
||||
|
||||
beforeEach(module('kibana.services'));
|
||||
@@ -21,40 +21,5 @@ define([
|
||||
_filterSrv.add({ name: 'test', current: { value: 'oogle' } });
|
||||
_filterSrv.init();
|
||||
});
|
||||
|
||||
it('should initialize template data', function() {
|
||||
var target = _filterSrv.applyFilterToTarget('this.[[test]].filters');
|
||||
expect(target).to.be('this.oogle.filters');
|
||||
});
|
||||
});
|
||||
|
||||
describe.only('filterOptionSelected', function() {
|
||||
beforeEach(function() {
|
||||
_filterSrv.add({ name: 'test' });
|
||||
_filterSrv.filterOptionSelected(_filterSrv.list[0], { value: 'muuuu' });
|
||||
});
|
||||
it('should set current value and update template data', function() {
|
||||
var target = _filterSrv.applyFilterToTarget('this.[[test]].filters');
|
||||
expect(target).to.be('this.muuuu.filters');
|
||||
});
|
||||
});
|
||||
|
||||
describe('timeRange', function() {
|
||||
it('should return unparsed when parse is false', function() {
|
||||
_filterSrv.setTime({from: 'now', to: 'now-1h' });
|
||||
var time = _filterSrv.timeRange(false);
|
||||
expect(time.from).to.be('now');
|
||||
expect(time.to).to.be('now-1h');
|
||||
});
|
||||
|
||||
it('should return parsed when parse is true', function() {
|
||||
_filterSrv.setTime({from: 'now', to: 'now-1h' });
|
||||
var time = _filterSrv.timeRange(true);
|
||||
expect(_.isDate(time.from)).to.be(true);
|
||||
expect(_.isDate(time.to)).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -3,6 +3,11 @@ module.exports = function(config) {
|
||||
dev: {
|
||||
configFile: 'src/test/karma.conf.js',
|
||||
singleRun: false,
|
||||
browsers: ['PhantomJS']
|
||||
},
|
||||
debug: {
|
||||
configFile: 'src/test/karma.conf.js',
|
||||
singleRun: true,
|
||||
browsers: ['Chrome']
|
||||
},
|
||||
test: {
|
||||
@@ -11,4 +16,4 @@ module.exports = function(config) {
|
||||
browsers: ['PhantomJS']
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user