LokiOptionFields.test.tsx 927 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { render, screen } from '@testing-library/react';
  2. import React from 'react';
  3. import { LokiOptionFieldsProps, LokiOptionFields } from './LokiOptionFields';
  4. const setup = (propOverrides?: LokiOptionFieldsProps) => {
  5. const queryType = 'range';
  6. const lineLimitValue = '1';
  7. const onLineLimitChange = jest.fn();
  8. const onQueryTypeChange = jest.fn();
  9. const onKeyDownFunc = jest.fn();
  10. const props: any = {
  11. queryType,
  12. lineLimitValue,
  13. onLineLimitChange,
  14. onQueryTypeChange,
  15. onKeyDownFunc,
  16. };
  17. Object.assign(props, propOverrides);
  18. return render(<LokiOptionFields {...props} />);
  19. };
  20. describe('LokiOptionFields', () => {
  21. it('should render step field', () => {
  22. setup();
  23. expect(screen.getByTestId('lineLimitField')).toBeInTheDocument();
  24. });
  25. it('should render query type field', () => {
  26. setup();
  27. expect(screen.getByTestId('queryTypeField')).toBeInTheDocument();
  28. });
  29. });