The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/app/plugins/datasource/prometheus/components/PromExploreExtraField.test.tsx

36 lines
931 B

import React from 'react';
import { render, screen } from '@testing-library/react';
import { PromExploreExtraFieldProps, PromExploreExtraField } from './PromExploreExtraField';
const setup = (propOverrides?: PromExploreExtraFieldProps) => {
const queryType = 'range';
const stepValue = '1';
const onStepChange = jest.fn();
const onQueryTypeChange = jest.fn();
const onKeyDownFunc = jest.fn();
const props: any = {
queryType,
stepValue,
onStepChange,
onQueryTypeChange,
onKeyDownFunc,
};
Object.assign(props, propOverrides);
return render(<PromExploreExtraField {...props} />);
};
describe('PromExploreExtraField', () => {
it('should render step field', () => {
setup();
expect(screen.getByTestId('stepField')).toBeInTheDocument();
});
it('should render query type field', () => {
setup();
expect(screen.getByTestId('queryTypeField')).toBeInTheDocument();
});
});