Commit 7d2646f6 by Torkel Ödegaard

refactor: moved influxdb specs to plugins folder

parent 1a8bc1dd
......@@ -2,10 +2,10 @@ define([
'angular',
'lodash',
'app/core/utils/datemath',
'./influxSeries',
'./queryBuilder',
'./influx_series',
'./query_builder',
'./directives',
'./queryCtrl',
'./query_ctrl',
],
function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) {
'use strict';
......
define([
'angular',
'lodash',
'./queryBuilder',
'./query_builder',
],
function (angular, _, InfluxQueryBuilder) {
'use strict';
......
define([
'app/plugins/datasource/influxdb/influxSeries'
], function(InfluxSeries) {
'use strict';
///<amd-dependency path="app/plugins/datasource/influxdb/influx_series" name="InfluxSeries"/>
describe('when generating timeseries from influxdb response', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var InfluxSeries: any;
describe('when generating timeseries from influxdb response', function() {
describe('given multiple fields for series', function() {
var options = { series: [
var options = {
alias: '',
series: [
{
name: 'cpu',
tags: {app: 'test', server: 'server1'},
columns: ['time', 'mean', 'max', 'min'],
values: [[1431946625000, 10, 11, 9], [1431946626000, 20, 21, 19]]
}
]};
]
};
describe('and no alias', function() {
it('should generate multiple datapoints for each column', function() {
var series = new InfluxSeries(options);
......@@ -96,7 +100,9 @@ define([
});
describe('given two series', function() {
var options = { series: [
var options = {
alias: '',
series: [
{
name: 'cpu',
tags: {app: 'test', server: 'server1'},
......@@ -109,7 +115,8 @@ define([
columns: ['time', 'mean'],
values: [[1431946625000, 15], [1431946626000, 16]]
}
]};
]
};
describe('and no alias', function() {
......@@ -158,14 +165,17 @@ define([
});
describe('given measurement with dots', function() {
var options = { series: [
var options = {
alias: '',
series: [
{
name: 'app.prod.server1.count',
tags: {},
columns: ['time', 'mean'],
values: [[1431946625000, 10], [1431946626000, 12]]
}
]};
]
};
it('should replace patterns', function() {
options.alias = 'alias: $1 -> [[3]]';
......@@ -175,6 +185,6 @@ define([
expect(result[0].target).to.be('alias: prod -> count');
});
});
});
});
define([
'app/plugins/datasource/influxdb/queryBuilder'
], function(InfluxQueryBuilder) {
'use strict';
///<amd-dependency path="app/plugins/datasource/influxdb/query_builder" name="InfluxQueryBuilder"/>
//
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
describe('InfluxQueryBuilder', function() {
declare var InfluxQueryBuilder: any;
describe('InfluxQueryBuilder', function() {
describe('series with mesurement only', function() {
it('should generate correct query', function() {
......@@ -182,6 +183,4 @@ define([
});
});
});
define([
'./helpers',
'app/plugins/datasource/influxdb/queryCtrl',
'app/services/uiSegmentSrv'
], function(helpers) {
'use strict';
describe('InfluxDBQueryCtrl', function() {
///<amd-dependency path="app/plugins/datasource/influxdb/query_ctrl"/>
///<amd-dependency path="app/services/uiSegmentSrv" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
declare var helpers: any;
describe('InfluxDBQueryCtrl', function() {
var ctx = new helpers.ControllerTestContext();
beforeEach(module('grafana.controllers'));
beforeEach(module('grafana.services'));
beforeEach(angularMocks.module('grafana.controllers'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase());
beforeEach(ctx.createControllerPhase('InfluxQueryCtrl'));
......@@ -184,5 +185,4 @@ define([
});
});
});
});
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