Commit 06fe5721 by Torkel Ödegaard

more work on filterSrv unit tests

parent dfd1d096
......@@ -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']
}
};
};
\ No newline at end of file
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment