mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: reduces strict null errors to 824 (#22744)
* Chore: reduces strict null errors with 100+ * Chore: lowers the build error number
This commit is contained in:
@@ -5,7 +5,7 @@ import { act } from 'react-dom/test-utils';
|
||||
import { DataSourceInstanceSettings } from '@grafana/data';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { CustomVariable } from 'app/features/templating/all';
|
||||
import { QueryEditor, Props } from './QueryEditor';
|
||||
import { Props, QueryEditor } from './QueryEditor';
|
||||
import CloudWatchDatasource from '../datasource';
|
||||
|
||||
const setup = () => {
|
||||
@@ -70,9 +70,10 @@ describe('QueryEditor', () => {
|
||||
|
||||
describe('should use correct default values', () => {
|
||||
it('when region is null is display default in the label', async () => {
|
||||
// @ts-ignore strict null error TS2345: Argument of type '() => Promise<void>' is not assignable to parameter of type '() => void | undefined'.
|
||||
await act(async () => {
|
||||
const props = setup();
|
||||
props.query.region = null;
|
||||
props.query.region = (null as unknown) as string;
|
||||
const wrapper = mount(<QueryEditor {...props} />);
|
||||
expect(
|
||||
wrapper
|
||||
@@ -86,14 +87,15 @@ describe('QueryEditor', () => {
|
||||
});
|
||||
|
||||
it('should init props correctly', async () => {
|
||||
// @ts-ignore strict null error TS2345: Argument of type '() => Promise<void>' is not assignable to parameter of type '() => void | undefined'.
|
||||
await act(async () => {
|
||||
const props = setup();
|
||||
props.query.namespace = null;
|
||||
props.query.metricName = null;
|
||||
props.query.expression = null;
|
||||
props.query.dimensions = null;
|
||||
props.query.region = null;
|
||||
props.query.statistics = null;
|
||||
props.query.namespace = (null as unknown) as string;
|
||||
props.query.metricName = (null as unknown) as string;
|
||||
props.query.expression = (null as unknown) as string;
|
||||
props.query.dimensions = (null as unknown) as { [key: string]: string | string[] };
|
||||
props.query.region = (null as unknown) as string;
|
||||
props.query.statistics = (null as unknown) as string[];
|
||||
const wrapper = mount(<QueryEditor {...props} />);
|
||||
const {
|
||||
query: { namespace, region, metricName, dimensions, statistics, expression },
|
||||
|
||||
Reference in New Issue
Block a user