pipelineView.spec.jsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import PipelineView from 'sentry/views/integrationPipeline/pipelineView';
  3. function MockAwsLambdaProjectSelect() {
  4. return <div>mock_AwsLambdaProjectSelect</div>;
  5. }
  6. jest.mock(
  7. 'sentry/views/integrationPipeline/awsLambdaProjectSelect',
  8. () => MockAwsLambdaProjectSelect
  9. );
  10. describe('PipelineView', () => {
  11. it('renders awsLambdaProjectSelect', () => {
  12. render(<PipelineView pipelineName="awsLambdaProjectSelect" someField="someVal" />);
  13. expect(screen.getByText('mock_AwsLambdaProjectSelect')).toBeInTheDocument();
  14. expect(document.title).toBe('AWS Lambda Select Project');
  15. });
  16. it('errros on invalid pipelineName', () => {
  17. jest.spyOn(console, 'error');
  18. // eslint-disable-next-line no-console
  19. console.error.mockImplementation(() => {});
  20. expect(() => render(<PipelineView pipelineName="other" />)).toThrow(
  21. 'Invalid pipeline name other'
  22. );
  23. // eslint-disable-next-line no-console
  24. console.error.mockRestore();
  25. });
  26. });