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.
35 lines
926 B
35 lines
926 B
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();
|
|
});
|
|
});
|
|
|