Commit a37a0c7b by Tobias Skarhed

Remove comments

parent 42ba0dc7
...@@ -5,7 +5,6 @@ import CloudWatchDatasource from '../datasource'; ...@@ -5,7 +5,6 @@ import CloudWatchDatasource from '../datasource';
import 'app/features/dashboard/time_srv'; import 'app/features/dashboard/time_srv';
describe('CloudWatchDatasource', function() { describe('CloudWatchDatasource', function() {
let instanceSettings = { let instanceSettings = {
jsonData: { defaultRegion: 'us-east-1', access: 'proxy' }, jsonData: { defaultRegion: 'us-east-1', access: 'proxy' },
}; };
...@@ -14,29 +13,12 @@ describe('CloudWatchDatasource', function() { ...@@ -14,29 +13,12 @@ describe('CloudWatchDatasource', function() {
let backendSrv = {}; let backendSrv = {};
let ctx = <any>{ let ctx = <any>{
backendSrv, backendSrv,
templateSrv templateSrv,
}; };
beforeEach(() => { beforeEach(() => {
ctx.ds = new CloudWatchDatasource(instanceSettings, {}, backendSrv, templateSrv, timeSrv); ctx.ds = new CloudWatchDatasource(instanceSettings, {}, backendSrv, templateSrv, timeSrv);
}); });
// beforeEach(angularMocks.module('grafana.core'));
// beforeEach(angularMocks.module('grafana.services'));
// beforeEach(angularMocks.module('grafana.controllers'));
// beforeEach(ctx.providePhase(['templateSrv', 'backendSrv']));
// beforeEach(ctx.createService('timeSrv'));
// beforeEach(
// angularMocks.inject(function($q, $rootScope, $httpBackend, $injector) {
// ctx.$q = $q;
// ctx.$httpBackend = $httpBackend;
// ctx.$rootScope = $rootScope;
// ctx.ds = $injector.instantiate(CloudWatchDatasource, {
// instanceSettings: instanceSettings,
// });
// $httpBackend.when('GET', /\.html$/).respond('');
// })
// );
describe('When performing CloudWatch query', function() { describe('When performing CloudWatch query', function() {
var requestParams; var requestParams;
...@@ -78,7 +60,7 @@ describe('CloudWatchDatasource', function() { ...@@ -78,7 +60,7 @@ describe('CloudWatchDatasource', function() {
}; };
beforeEach(async () => { beforeEach(async () => {
ctx.backendSrv.datasourceRequest = await jest.fn((params) => { ctx.backendSrv.datasourceRequest = await jest.fn(params => {
requestParams = params.data; requestParams = params.data;
return Promise.resolve({ data: response }); return Promise.resolve({ data: response });
}); });
...@@ -94,7 +76,6 @@ describe('CloudWatchDatasource', function() { ...@@ -94,7 +76,6 @@ describe('CloudWatchDatasource', function() {
expect(params.period).toBe(query.targets[0].period); expect(params.period).toBe(query.targets[0].period);
done(); done();
}); });
//ctx.$rootScope.$apply();
}); });
it('should generate the correct query with interval variable', function(done) { it('should generate the correct query with interval variable', function(done) {
...@@ -124,7 +105,6 @@ describe('CloudWatchDatasource', function() { ...@@ -124,7 +105,6 @@ describe('CloudWatchDatasource', function() {
expect(params.period).toBe('600'); expect(params.period).toBe('600');
done(); done();
}); });
//ctx.$rootScope.$apply();
}); });
it('should return series list', function(done) { it('should return series list', function(done) {
...@@ -133,7 +113,6 @@ describe('CloudWatchDatasource', function() { ...@@ -133,7 +113,6 @@ describe('CloudWatchDatasource', function() {
expect(result.data[0].datapoints[0][0]).toBe(response.results.A.series[0].points[0][0]); expect(result.data[0].datapoints[0][0]).toBe(response.results.A.series[0].points[0][0]);
done(); done();
}); });
//ctx.$rootScope.$apply();
}); });
it('should generate the correct targets by expanding template variables', function() { it('should generate the correct targets by expanding template variables', function() {
...@@ -249,7 +228,7 @@ describe('CloudWatchDatasource', function() { ...@@ -249,7 +228,7 @@ describe('CloudWatchDatasource', function() {
var requestParams; var requestParams;
beforeEach(function() { beforeEach(function() {
ctx.ds.performTimeSeriesQuery = jest.fn((request) => { ctx.ds.performTimeSeriesQuery = jest.fn(request => {
requestParams = request; requestParams = request;
return Promise.resolve({ data: {} }); return Promise.resolve({ data: {} });
}); });
...@@ -277,7 +256,6 @@ describe('CloudWatchDatasource', function() { ...@@ -277,7 +256,6 @@ describe('CloudWatchDatasource', function() {
expect(requestParams.queries[0].region).toBe(instanceSettings.jsonData.defaultRegion); expect(requestParams.queries[0].region).toBe(instanceSettings.jsonData.defaultRegion);
done(); done();
}); });
//ctx.$rootScope.$apply();
}); });
}); });
...@@ -321,7 +299,7 @@ describe('CloudWatchDatasource', function() { ...@@ -321,7 +299,7 @@ describe('CloudWatchDatasource', function() {
}; };
beforeEach(function() { beforeEach(function() {
ctx.backendSrv.datasourceRequest = jest.fn((params) => { ctx.backendSrv.datasourceRequest = jest.fn(params => {
return Promise.resolve({ data: response }); return Promise.resolve({ data: response });
}); });
}); });
...@@ -332,7 +310,6 @@ describe('CloudWatchDatasource', function() { ...@@ -332,7 +310,6 @@ describe('CloudWatchDatasource', function() {
expect(result.data[0].datapoints[0][0]).toBe(response.results.A.series[0].points[0][0]); expect(result.data[0].datapoints[0][0]).toBe(response.results.A.series[0].points[0][0]);
done(); done();
}); });
//ctx.$rootScope.$apply();
}); });
}); });
...@@ -342,14 +319,13 @@ describe('CloudWatchDatasource', function() { ...@@ -342,14 +319,13 @@ describe('CloudWatchDatasource', function() {
scenario.setup = setupCallback => { scenario.setup = setupCallback => {
beforeEach(() => { beforeEach(() => {
setupCallback(); setupCallback();
ctx.backendSrv.datasourceRequest = jest.fn((args) => { ctx.backendSrv.datasourceRequest = jest.fn(args => {
scenario.request = args.data; scenario.request = args.data;
return Promise.resolve({ data: scenario.requestResponse }); return Promise.resolve({ data: scenario.requestResponse });
}); });
ctx.ds.metricFindQuery(query).then(args => { ctx.ds.metricFindQuery(query).then(args => {
scenario.result = args; scenario.result = args;
}); });
//ctx.$rootScope.$apply();
}); });
}; };
......
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