Chore: Update grafana-prometheus test types (#81816)

* Update types

* update betterer
This commit is contained in:
ismail simsek 2024-02-05 13:15:54 +01:00 committed by GitHub
parent b6668b47ef
commit 35514d7bc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 19 deletions

View File

@ -583,11 +583,6 @@ exports[`better eslint`] = {
"packages/grafana-prometheus/src/configuration/ExemplarsSettings.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
],
"packages/grafana-prometheus/src/datasource.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"packages/grafana-prometheus/src/datasource.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
@ -636,9 +631,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"]
],
"packages/grafana-prometheus/src/metric_find_query.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"packages/grafana-prometheus/src/metric_find_query.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
@ -755,9 +747,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"packages/grafana-prometheus/src/result_transformer.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"packages/grafana-prometheus/src/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],

View File

@ -5,9 +5,11 @@ import {
AnnotationEvent,
AnnotationQueryRequest,
CoreApp,
CustomVariableModel,
DataQueryRequest,
DataSourceInstanceSettings,
dateTime,
LoadingState,
rangeUtil,
TimeRange,
VariableHide,
@ -461,7 +463,7 @@ describe('PrometheusDatasource', () => {
});
describe('When interpolating variables', () => {
let customVariable: any;
let customVariable: CustomVariableModel;
beforeEach(() => {
customVariable = {
id: '',
@ -474,11 +476,14 @@ describe('PrometheusDatasource', () => {
current: {},
name: '',
type: 'custom',
label: null,
error: null,
rootStateKey: '',
state: LoadingState.Done,
description: '',
label: undefined,
hide: VariableHide.dontHide,
skipUrlSync: false,
index: -1,
initLock: null,
};
});
@ -490,7 +495,7 @@ describe('PrometheusDatasource', () => {
describe('and value is a number', () => {
it('should return a number', () => {
expect(ds.interpolateQueryExpr(1000 as any, customVariable)).toEqual(1000);
expect(ds.interpolateQueryExpr(1000 as unknown as string, customVariable)).toEqual(1000);
});
});
@ -861,7 +866,7 @@ describe('PrometheusDatasource2', () => {
});
describe('region annotations for sectors', () => {
const options: any = {
const options = {
annotation: {
expr: 'ALERTS{alertstate="firing"}',
tagKeys: 'job',
@ -872,7 +877,7 @@ describe('PrometheusDatasource2', () => {
from: time({ seconds: 63 }),
to: time({ seconds: 900 }),
},
};
} as unknown as AnnotationQueryRequest;
async function runAnnotationQuery(data: number[][]) {
let response = createAnnotationResponse();

View File

@ -62,7 +62,15 @@ describe('PrometheusMetricFindQuery', () => {
);
});
const setupMetricFindQuery = (data: any, datasource?: PrometheusDatasource) => {
const setupMetricFindQuery = (
data: {
query: string;
response: {
data: unknown;
};
},
datasource?: PrometheusDatasource
) => {
fetchMock.mockImplementation(() => of({ status: 'success', data: data.response } as unknown as FetchResponse));
return new PrometheusMetricFindQuery(datasource ?? legacyPrometheusDatasource, data.query);
};

View File

@ -909,7 +909,7 @@ describe('Prometheus Result Transformer', () => {
},
],
} as unknown as DataQueryRequest<PromQuery>;
const testOptions: any = {
const testOptions = {
exemplarTraceIdDestinations: [
{
name: 'traceID',