Chore: more ts test fixes (#63438)

* replace anys in tests

* more test fixes

* clean up any's in tests
This commit is contained in:
Ashley Harrison
2023-02-23 10:07:44 +00:00
committed by GitHub
parent bcaf4dc0b1
commit 4a2695349d
39 changed files with 187 additions and 349 deletions

View File

@@ -1,7 +1,9 @@
import { TemplateSrv } from 'app/features/templating/template_srv';
import InfluxQueryModel from '../influx_query_model';
describe('InfluxQuery', () => {
const templateSrv: any = { replace: (val: any) => val };
const templateSrv = { replace: (val) => val } as TemplateSrv;
describe('render series with measurement only', () => {
it('should generate correct query', () => {

View File

@@ -2,7 +2,7 @@ import { size } from 'lodash';
import { of } from 'rxjs';
import { TemplateSrvStub } from 'test/specs/helpers';
import { FieldType, MutableDataFrame } from '@grafana/data';
import { AnnotationEvent, DataQueryRequest, FieldType, MutableDataFrame } from '@grafana/data';
import { FetchResponse } from '@grafana/runtime';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
@@ -313,14 +313,14 @@ describe('influxdb response parser', () => {
tagsColumn: 'host,path',
};
const queryOptions: any = {
const queryOptions = {
targets: [annotation],
range: {
from: '2018-01-01T00:00:00Z',
to: '2018-01-02T00:00:00Z',
},
};
let response: any;
} as unknown as DataQueryRequest;
let response: AnnotationEvent[];
beforeEach(async () => {
fetchMock.mockImplementation(() => {
@@ -433,13 +433,13 @@ describe('influxdb response parser', () => {
expect(response[0].time).toBe(1645208701000);
expect(response[0].title).toBe('Station softwareupdated[447]: Adding client 1');
expect(response[0].text).toBe('text 1');
expect(response[0].tags[0]).toBe('cbfa07e0e3bb 1');
expect(response[0].tags[1]).toBe('/var/log/host/install.log 1');
expect(response[0].tags?.[0]).toBe('cbfa07e0e3bb 1');
expect(response[0].tags?.[1]).toBe('/var/log/host/install.log 1');
expect(response[1].time).toBe(1645208702000);
expect(response[1].title).toBe('Station softwareupdated[447]: Adding client 2');
expect(response[1].text).toBe('text 2');
expect(response[1].tags[0]).toBe('cbfa07e0e3bb 2');
expect(response[1].tags[1]).toBe('/var/log/host/install.log 2');
expect(response[1].tags?.[0]).toBe('cbfa07e0e3bb 2');
expect(response[1].tags?.[1]).toBe('/var/log/host/install.log 2');
});
});
});