pipelineView.spec.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // The pipeline view renders a Router inside of it and
  2. // does not need the providers provided by our wrapped render function.
  3. // Use the original to avoid doubling up.
  4. // eslint-disable-next-line no-restricted-imports
  5. import {render, screen} from '@testing-library/react';
  6. import PipelineView from 'sentry/views/integrationPipeline/pipelineView';
  7. function MockAwsLambdaProjectSelect() {
  8. return <div>mock_AwsLambdaProjectSelect</div>;
  9. }
  10. jest.mock(
  11. 'sentry/views/integrationPipeline/awsLambdaProjectSelect',
  12. () => MockAwsLambdaProjectSelect
  13. );
  14. describe('PipelineView', () => {
  15. afterEach(() => {
  16. jest.restoreAllMocks();
  17. });
  18. it('renders awsLambdaProjectSelect', () => {
  19. render(<PipelineView pipelineName="awsLambdaProjectSelect" someField="someVal" />);
  20. expect(screen.getByText('mock_AwsLambdaProjectSelect')).toBeInTheDocument();
  21. expect(document.title).toBe('AWS Lambda Select Project');
  22. });
  23. it('errros on invalid pipelineName', () => {
  24. jest.spyOn(console, 'error').mockImplementation(() => {});
  25. expect(() => render(<PipelineView pipelineName="other" />)).toThrow(
  26. 'Invalid pipeline name other'
  27. );
  28. });
  29. });