Slight refactoring, #1525

This commit is contained in:
Torkel Ödegaard
2015-05-16 16:46:24 +02:00
parent 7a41ecb63f
commit 05d725d0b8
4 changed files with 45 additions and 31 deletions

View File

@@ -62,6 +62,34 @@ define([
});
});
describe('when building tag keys query', function() {
describe('given picked measurement', function() {
it('build query with measurement filter', function() {
var builder = new InfluxQueryBuilder({ measurement: 'cpu', tags: [] });
var query = builder.showTagsQuery();
expect(query).to.be('SHOW TAG KEYS FROM "cpu"');
});
});
describe('given no picked measurement', function() {
it('build query without filter', function() {
var builder = new InfluxQueryBuilder({ measurement: '', tags: [] });
var query = builder.showTagsQuery();
expect(query).to.be('SHOW TAG KEYS');
});
});
describe('given an existing tag', function() {
it('build query with filter', function() {
var builder = new InfluxQueryBuilder({ measurement: '', tags: [{key: 'host', value: 'se1'}] });
var query = builder.showTagsQuery();
expect(query).to.be('SHOW TAG KEYS');
});
});
});
});
});

View File

@@ -198,23 +198,6 @@ define([
});
});
describe('when building tag keys query', function() {
describe('given picked measurement', function() {
it('build query with measurement filter', function() {
var query = ctx.scope.buildTagKeysQuery({ measurement: 'cpu', tags: [] }, {type: 'key'});
expect(query).to.be('SHOW TAG KEYS FROM "cpu"');
});
});
describe('given no picked measurement', function() {
it('build query without filter', function() {
var query = ctx.scope.buildTagKeysQuery({ measurement: '', tags: [] }, {type: 'key'});
expect(query).to.be('SHOW TAG KEYS');
});
});
});
});
});