mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 07:26:31 +08:00
changed functions to arrowfunctions for only-arrow-functions rule (#13127)
This commit is contained in:

committed by
Torkel Ödegaard

parent
826dfceac0
commit
0f326f18dc
@ -2,7 +2,7 @@ import moment from 'moment';
|
||||
import { PostgresDatasource } from '../datasource';
|
||||
import { CustomVariable } from 'app/features/templating/custom_variable';
|
||||
|
||||
describe('PostgreSQLDatasource', function() {
|
||||
describe('PostgreSQLDatasource', () => {
|
||||
const instanceSettings = { name: 'postgresql' };
|
||||
|
||||
const backendSrv = {};
|
||||
@ -28,7 +28,7 @@ describe('PostgreSQLDatasource', function() {
|
||||
ctx.ds = new PostgresDatasource(instanceSettings, backendSrv, {}, templateSrv, ctx.timeSrvMock);
|
||||
});
|
||||
|
||||
describe('When performing annotationQuery', function() {
|
||||
describe('When performing annotationQuery', () => {
|
||||
let results;
|
||||
|
||||
const annotationName = 'MyAnno';
|
||||
@ -62,16 +62,16 @@ describe('PostgreSQLDatasource', function() {
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
ctx.backendSrv.datasourceRequest = jest.fn(options => {
|
||||
return Promise.resolve({ data: response, status: 200 });
|
||||
});
|
||||
ctx.ds.annotationQuery(options).then(function(data) {
|
||||
ctx.ds.annotationQuery(options).then(data => {
|
||||
results = data;
|
||||
});
|
||||
});
|
||||
|
||||
it('should return annotation list', function() {
|
||||
it('should return annotation list', () => {
|
||||
expect(results.length).toBe(3);
|
||||
|
||||
expect(results[0].text).toBe('some text');
|
||||
@ -85,7 +85,7 @@ describe('PostgreSQLDatasource', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery', function() {
|
||||
describe('When performing metricFindQuery', () => {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
@ -105,23 +105,23 @@ describe('PostgreSQLDatasource', function() {
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
ctx.backendSrv.datasourceRequest = jest.fn(options => {
|
||||
return Promise.resolve({ data: response, status: 200 });
|
||||
});
|
||||
ctx.ds.metricFindQuery(query).then(function(data) {
|
||||
ctx.ds.metricFindQuery(query).then(data => {
|
||||
results = data;
|
||||
});
|
||||
});
|
||||
|
||||
it('should return list of all column values', function() {
|
||||
it('should return list of all column values', () => {
|
||||
expect(results.length).toBe(6);
|
||||
expect(results[0].text).toBe('aTitle');
|
||||
expect(results[5].text).toBe('some text3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery with key, value columns', function() {
|
||||
describe('When performing metricFindQuery with key, value columns', () => {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
@ -141,16 +141,16 @@ describe('PostgreSQLDatasource', function() {
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
ctx.backendSrv.datasourceRequest = jest.fn(options => {
|
||||
return Promise.resolve({ data: response, status: 200 });
|
||||
});
|
||||
ctx.ds.metricFindQuery(query).then(function(data) {
|
||||
ctx.ds.metricFindQuery(query).then(data => {
|
||||
results = data;
|
||||
});
|
||||
});
|
||||
|
||||
it('should return list of as text, value', function() {
|
||||
it('should return list of as text, value', () => {
|
||||
expect(results.length).toBe(3);
|
||||
expect(results[0].text).toBe('aTitle');
|
||||
expect(results[0].value).toBe('value1');
|
||||
@ -159,7 +159,7 @@ describe('PostgreSQLDatasource', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('When performing metricFindQuery with key, value columns and with duplicate keys', function() {
|
||||
describe('When performing metricFindQuery with key, value columns and with duplicate keys', () => {
|
||||
let results;
|
||||
const query = 'select * from atable';
|
||||
const response = {
|
||||
@ -183,13 +183,13 @@ describe('PostgreSQLDatasource', function() {
|
||||
ctx.backendSrv.datasourceRequest = jest.fn(options => {
|
||||
return Promise.resolve({ data: response, status: 200 });
|
||||
});
|
||||
ctx.ds.metricFindQuery(query).then(function(data) {
|
||||
ctx.ds.metricFindQuery(query).then(data => {
|
||||
results = data;
|
||||
});
|
||||
//ctx.$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return list of unique keys', function() {
|
||||
it('should return list of unique keys', () => {
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].text).toBe('aTitle');
|
||||
expect(results[0].value).toBe('same');
|
||||
@ -197,7 +197,7 @@ describe('PostgreSQLDatasource', function() {
|
||||
});
|
||||
|
||||
describe('When interpolating variables', () => {
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
ctx.variable = new CustomVariable({}, {});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user