mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* WIP Add line limit and query type switch toLoki dashboard editor * Refactor, reuse code for both - Explore and Dashboard * Üpdate snapshot tests * Refactor and unify * Rename test file * Update test
36 lines
926 B
TypeScript
36 lines
926 B
TypeScript
import React from 'react';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { LokiOptionFieldsProps, LokiOptionFields } from './LokiOptionFields';
|
|
|
|
const setup = (propOverrides?: LokiOptionFieldsProps) => {
|
|
const queryType = 'range';
|
|
const lineLimitValue = '1';
|
|
const onLineLimitChange = jest.fn();
|
|
const onQueryTypeChange = jest.fn();
|
|
const onKeyDownFunc = jest.fn();
|
|
|
|
const props: any = {
|
|
queryType,
|
|
lineLimitValue,
|
|
onLineLimitChange,
|
|
onQueryTypeChange,
|
|
onKeyDownFunc,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
return render(<LokiOptionFields {...props} />);
|
|
};
|
|
|
|
describe('LokiOptionFields', () => {
|
|
it('should render step field', () => {
|
|
setup();
|
|
expect(screen.getByTestId('lineLimitField')).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render query type field', () => {
|
|
setup();
|
|
expect(screen.getByTestId('queryTypeField')).toBeInTheDocument();
|
|
});
|
|
});
|