mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tslint: autofix of let -> const (#13033)
This commit is contained in:
@@ -2,14 +2,14 @@ import { BackendSrv } from 'app/core/services/backend_srv';
|
||||
jest.mock('app/core/store');
|
||||
|
||||
describe('backend_srv', function() {
|
||||
let _httpBackend = options => {
|
||||
const _httpBackend = options => {
|
||||
if (options.url === 'gateway-error') {
|
||||
return Promise.reject({ status: 502 });
|
||||
}
|
||||
return Promise.resolve({});
|
||||
};
|
||||
|
||||
let _backendSrv = new BackendSrv(_httpBackend, {}, {}, {}, {});
|
||||
const _backendSrv = new BackendSrv(_httpBackend, {}, {}, {}, {});
|
||||
|
||||
describe('when handling errors', () => {
|
||||
it('should return the http status code', async () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as fileExport from '../utils/file_export';
|
||||
import { beforeEach, expect } from 'test/lib/common';
|
||||
|
||||
describe('file_export', () => {
|
||||
let ctx: any = {};
|
||||
const ctx: any = {};
|
||||
|
||||
beforeEach(() => {
|
||||
ctx.seriesList = [
|
||||
@@ -28,7 +28,7 @@ describe('file_export', () => {
|
||||
|
||||
describe('when exporting series as rows', () => {
|
||||
it('should export points in proper order', () => {
|
||||
let text = fileExport.convertSeriesListToCsv(ctx.seriesList, ctx.timeFormat);
|
||||
const text = fileExport.convertSeriesListToCsv(ctx.seriesList, ctx.timeFormat);
|
||||
const expectedText =
|
||||
'"Series";"Time";"Value"\r\n' +
|
||||
'"series_1";"1500026100";1\r\n' +
|
||||
@@ -48,7 +48,7 @@ describe('file_export', () => {
|
||||
|
||||
describe('when exporting series as columns', () => {
|
||||
it('should export points in proper order', () => {
|
||||
let text = fileExport.convertSeriesListToCsvColumns(ctx.seriesList, ctx.timeFormat);
|
||||
const text = fileExport.convertSeriesListToCsvColumns(ctx.seriesList, ctx.timeFormat);
|
||||
const expectedText =
|
||||
'"Time";"series_1";"series_2"\r\n' +
|
||||
'"1500026100";1;11\r\n' +
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('SearchCtrl', () => {
|
||||
search: (options: any) => {},
|
||||
getDashboardTags: () => {},
|
||||
};
|
||||
let ctrl = new SearchCtrl({ $on: () => {} }, {}, {}, <SearchSrv>searchSrvStub);
|
||||
const ctrl = new SearchCtrl({ $on: () => {} }, {}, {}, <SearchSrv>searchSrvStub);
|
||||
|
||||
describe('Given an empty result', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('SearchResultsCtrl', () => {
|
||||
let ctrl;
|
||||
|
||||
describe('when checking an item that is not checked', () => {
|
||||
let item = { checked: false };
|
||||
const item = { checked: false };
|
||||
let selectionChanged = false;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -31,7 +31,7 @@ describe('SearchResultsCtrl', () => {
|
||||
});
|
||||
|
||||
describe('when checking an item that is checked', () => {
|
||||
let item = { checked: true };
|
||||
const item = { checked: true };
|
||||
let selectionChanged = false;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -72,7 +72,7 @@ describe('SearchResultsCtrl', () => {
|
||||
folderExpanded = true;
|
||||
};
|
||||
|
||||
let folder = {
|
||||
const folder = {
|
||||
expanded: false,
|
||||
toggle: () => Promise.resolve(folder),
|
||||
};
|
||||
@@ -94,7 +94,7 @@ describe('SearchResultsCtrl', () => {
|
||||
folderExpanded = true;
|
||||
};
|
||||
|
||||
let folder = {
|
||||
const folder = {
|
||||
expanded: true,
|
||||
toggle: () => Promise.resolve(folder),
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as ticks from '../utils/ticks';
|
||||
|
||||
describe('ticks', () => {
|
||||
describe('getFlotTickDecimals()', () => {
|
||||
let ctx: any = {};
|
||||
const ctx: any = {};
|
||||
|
||||
beforeEach(() => {
|
||||
ctx.axis = {};
|
||||
|
||||
@@ -329,7 +329,7 @@ describe('TimeSeries', function() {
|
||||
|
||||
describe('legend decimals', function() {
|
||||
let series, panel;
|
||||
let height = 200;
|
||||
const height = 200;
|
||||
beforeEach(function() {
|
||||
testData = {
|
||||
alias: 'test',
|
||||
@@ -348,7 +348,7 @@ describe('TimeSeries', function() {
|
||||
});
|
||||
|
||||
it('should set decimals based on Y axis (expect calculated decimals = 1)', function() {
|
||||
let data = [series];
|
||||
const data = [series];
|
||||
// Expect ticks with this data will have decimals = 1
|
||||
updateLegendValues(data, panel, height);
|
||||
expect(data[0].decimals).toBe(2);
|
||||
@@ -358,21 +358,21 @@ describe('TimeSeries', function() {
|
||||
testData.datapoints = [[10, 2], [0, 3], [100, 4], [80, 5]];
|
||||
series = new TimeSeries(testData);
|
||||
series.getFlotPairs();
|
||||
let data = [series];
|
||||
const data = [series];
|
||||
updateLegendValues(data, panel, height);
|
||||
expect(data[0].decimals).toBe(0);
|
||||
});
|
||||
|
||||
it('should set decimals to Y axis decimals + 1', function() {
|
||||
panel.yaxes[0].decimals = 2;
|
||||
let data = [series];
|
||||
const data = [series];
|
||||
updateLegendValues(data, panel, height);
|
||||
expect(data[0].decimals).toBe(3);
|
||||
});
|
||||
|
||||
it('should set decimals to legend decimals value if it was set explicitly', function() {
|
||||
panel.decimals = 3;
|
||||
let data = [series];
|
||||
const data = [series];
|
||||
updateLegendValues(data, panel, height);
|
||||
expect(data[0].decimals).toBe(3);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ValueSelectDropdownCtrl } from '../directives/value_select_dropdown';
|
||||
import q from 'q';
|
||||
|
||||
describe('SelectDropdownCtrl', () => {
|
||||
let tagValuesMap: any = {};
|
||||
const tagValuesMap: any = {};
|
||||
|
||||
ValueSelectDropdownCtrl.prototype.onUpdated = jest.fn();
|
||||
let ctrl;
|
||||
|
||||
Reference in New Issue
Block a user