2020-02-06 12:37:30 +00:00
|
|
|
import React from 'react';
|
2020-09-28 21:25:16 +02:00
|
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
|
import { PromExploreExtraFieldProps, PromExploreExtraField } from './PromExploreExtraField';
|
2020-02-06 12:37:30 +00:00
|
|
|
|
|
|
|
|
const setup = (propOverrides?: PromExploreExtraFieldProps) => {
|
2020-09-28 21:25:16 +02:00
|
|
|
const queryType = 'range';
|
|
|
|
|
const stepValue = '1';
|
|
|
|
|
const onStepChange = jest.fn();
|
|
|
|
|
const onQueryTypeChange = jest.fn();
|
2020-02-06 12:37:30 +00:00
|
|
|
const onKeyDownFunc = jest.fn();
|
|
|
|
|
|
|
|
|
|
const props: any = {
|
2020-09-28 21:25:16 +02:00
|
|
|
queryType,
|
|
|
|
|
stepValue,
|
|
|
|
|
onStepChange,
|
|
|
|
|
onQueryTypeChange,
|
2020-02-06 12:37:30 +00:00
|
|
|
onKeyDownFunc,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
|
|
2020-09-28 21:25:16 +02:00
|
|
|
return render(<PromExploreExtraField {...props} />);
|
2020-02-06 12:37:30 +00:00
|
|
|
};
|
|
|
|
|
|
2020-09-28 21:25:16 +02:00
|
|
|
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();
|
2020-02-06 12:37:30 +00:00
|
|
|
});
|
|
|
|
|
});
|