PromExploreExtraField.test.tsx 882 B

12345678910111213141516171819202122232425262728293031323334
  1. import { render, screen } from '@testing-library/react';
  2. import React from 'react';
  3. import { PromExploreExtraFieldProps, PromExploreExtraField, testIds } from './PromExploreExtraField';
  4. const setup = (propOverrides?: PromExploreExtraFieldProps) => {
  5. const query = { exemplar: false };
  6. const datasource = {};
  7. const onChange = jest.fn();
  8. const onRunQuery = jest.fn();
  9. const props: any = {
  10. onChange,
  11. onRunQuery,
  12. query,
  13. datasource,
  14. };
  15. Object.assign(props, propOverrides);
  16. return render(<PromExploreExtraField {...props} />);
  17. };
  18. describe('PromExploreExtraField', () => {
  19. it('should render step field', () => {
  20. setup();
  21. expect(screen.getByTestId(testIds.stepField)).toBeInTheDocument();
  22. });
  23. it('should render query type field', () => {
  24. setup();
  25. expect(screen.getByTestId(testIds.queryTypeField)).toBeInTheDocument();
  26. });
  27. });