Commit 8a39b32b by Torkel Ödegaard

refactor: moved elasticsearch specs to plugin folder and to typescript

parent 7d2646f6
define([
'angular',
'lodash',
'./queryDef',
'./query_def',
],
function (angular, _, queryDef) {
'use strict';
......
......@@ -3,10 +3,10 @@ define([
'lodash',
'moment',
'kbn',
'./queryBuilder',
'./indexPattern',
'./elasticResponse',
'./queryCtrl',
'./query_builder',
'./index_pattern',
'./elastic_response',
'./query_ctrl',
'./directives'
],
function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticResponse) {
......
define([
'angular',
'./bucketAgg',
'./metricAgg',
'./bucket_agg',
'./metric_agg',
],
function (angular) {
'use strict';
......
define([
'angular',
'lodash',
'./queryDef'
'./query_def'
],
function (angular, _, queryDef) {
'use strict';
......
define([
'./helpers',
'moment',
'angular',
'app/plugins/datasource/elasticsearch/datasource',
], function(helpers, moment, angular) {
'use strict';
///<amd-dependency path="../datasource" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
describe('ElasticDatasource', function() {
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import moment = require('moment');
import angular = require('angular');
declare var helpers: any;
describe('ElasticDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.services'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv', 'backendSrv']));
beforeEach(ctx.createService('ElasticDatasource'));
beforeEach(function() {
......@@ -69,9 +70,5 @@ define([
var header = angular.fromJson(parts[0]);
expect(header.index).to.eql(['asd-2015.05.30', 'asd-2015.05.31', 'asd-2015.06.01']);
});
});
});
});
define([
'app/plugins/datasource/elasticsearch/elasticResponse',
], function(ElasticResponse) {
'use strict';
///<amd-dependency path="../elastic_response" name="ElasticResponse"/>
describe('ElasticResponse', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var ElasticResponse: any;
describe('ElasticResponse', function() {
var targets;
var response;
var result;
......@@ -410,5 +411,4 @@ define([
});
});
});
});
define([
'moment',
'app/plugins/datasource/elasticsearch/indexPattern'
], function(moment, IndexPattern) {
'use strict';
///<amd-dependency path="../index_pattern" name="IndexPattern"/>
///<amd-dependency path="test/specs/helpers" name="helpers" />
describe('IndexPattern', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
import moment = require('moment');
declare var IndexPattern: any;
describe('IndexPattern', function() {
describe('when getting index for today', function() {
it('should return correct index name', function() {
......@@ -44,9 +46,6 @@ define([
});
});
});
});
});
define([
'app/plugins/datasource/elasticsearch/queryBuilder'
], function(ElasticQueryBuilder) {
'use strict';
///<amd-dependency path="../query_builder" name="ElasticQueryBuilder"/>
describe('ElasticQueryBuilder', function() {
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var ElasticQueryBuilder: any;
describe('ElasticQueryBuilder', function() {
var builder;
beforeEach(function() {
......@@ -119,6 +120,4 @@ define([
expect(query.aggs["2"].aggs["4"].date_histogram.field).to.be("@timestamp");
});
});
});
define([
'./helpers',
'app/plugins/datasource/elasticsearch/queryCtrl',
'app/services/uiSegmentSrv'
], function(helpers) {
'use strict';
///<amd-dependency path="../query_ctrl" />
///<amd-dependency path="app/services/uiSegmentSrv" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
describe('ElasticQueryCtrl', function() {
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
declare var helpers: any;
describe('ElasticQueryCtrl', 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('ElasticQueryCtrl'));
......@@ -25,8 +26,5 @@ define([
beforeEach(function() {
ctx.scope.init();
});
});
});
});
///<amd-dependency path="app/plugins/datasource/influxdb/query_builder" name="InfluxQueryBuilder"/>
//
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
declare var InfluxQueryBuilder: any;
......
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