influxdb annotation column mapping is working

This commit is contained in:
Torkel Ödegaard
2014-07-18 19:19:30 +02:00
parent cf2ef0955d
commit cf68725c89
4 changed files with 78 additions and 33 deletions

View File

@@ -140,33 +140,56 @@ define([
});
describe("when creating annotations from influxdb response", function() {
describe('given two series', function() {
describe('given column mapping for all columns', function() {
var series = new InfluxSeries({
seriesList: [
{
columns: ['time', 'text', 'sequence_number', 'title', 'tags'],
name: 'events1',
points: [[1402596000, 'some text', 1, 'Hello', 'B'], [1402596001, 'asd', 2, 'Hello2', 'B']]
}
],
annotation: {
query: 'select',
titleColumn: 'title',
tagsColumn: 'tags',
textColumn: 'text',
}
});
var result = series.getAnnotations();
it(' should generate 2 annnotations ', function() {
expect(result.length).to.be(2);
expect(result[0].annotation.query).to.be('select');
expect(result[0].title).to.be('Hello');
expect(result[0].time).to.be(1402596000000);
expect(result[0].tags).to.be('B');
expect(result[0].text).to.be('some text');
});
});
describe('given no column mapping', function() {
var series = new InfluxSeries({
seriesList: [
{
columns: ['time', 'text', 'sequence_number'],
name: 'events1',
points: [[1402596000, 'some text', 1], [1402596001, 'asd', 2]]
},
{
columns: ['time', 'tags', 'text'],
name: 'events2',
points: [[1402596000, 'tag1, tag2', 'mu']]
points: [[1402596000, 'some text', 1]]
}
],
annotation: {query: 'select'}
annotation: { query: 'select' }
});
var result = series.getAnnotations();
it(' should generate 4 annnotations ', function() {
expect(result.length).to.be(3);
expect(result[0].annotation.query).to.be('select');
it('should generate 1 annnotation', function() {
expect(result.length).to.be(1);
expect(result[0].title).to.be('some text');
expect(result[0].time).to.be(1402596000000);
expect(result[1].title).to.be('asd');
//expect(result[2].tags).to.be('tag1, tag2');
//expect(result[2].title).to.be('mu');
expect(result[0].tags).to.be(undefined);
expect(result[0].text).to.be(undefined);
});
});