pipelineView.spec.jsx 1018 B

12345678910111213141516171819202122232425262728293031323334353637
  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');
  21. // eslint-disable-next-line no-console
  22. console.error.mockImplementation(() => {});
  23. expect(() => render(<PipelineView pipelineName="other" />)).toThrow(
  24. 'Invalid pipeline name other'
  25. );
  26. });
  27. });