pipelineView.spec.tsx 955 B

12345678910111213141516171819202122232425262728293031323334
  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. afterEach(() => {
  12. jest.restoreAllMocks();
  13. });
  14. it('renders awsLambdaProjectSelect', () => {
  15. render(<PipelineView pipelineName="awsLambdaProjectSelect" someField="someVal" />);
  16. expect(screen.getByText('mock_AwsLambdaProjectSelect')).toBeInTheDocument();
  17. expect(document.title).toBe('AWS Lambda Select Project');
  18. });
  19. it('errros on invalid pipelineName', () => {
  20. jest.spyOn(console, 'error').mockImplementation(() => {});
  21. expect(() => render(<PipelineView pipelineName="other" />)).toThrow(
  22. 'Invalid pipeline name other'
  23. );
  24. });
  25. });