awsLambdaProjectSelect.spec.tsx 977 B

12345678910111213141516171819202122232425262728293031
  1. import selectEvent from 'react-select-event';
  2. import {Project as ProjectFixture} from 'sentry-fixture/project';
  3. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  4. import AwsLambdaProjectSelect from 'sentry/views/integrationPipeline/awsLambdaProjectSelect';
  5. describe('AwsLambdaProjectSelect', () => {
  6. let projects;
  7. let windowAssignMock;
  8. beforeEach(() => {
  9. windowAssignMock = jest.fn();
  10. window.location.assign = windowAssignMock;
  11. projects = [
  12. ProjectFixture(),
  13. ProjectFixture({id: '53', name: 'My Proj', slug: 'my-proj'}),
  14. ];
  15. });
  16. it('submit project', async () => {
  17. render(<AwsLambdaProjectSelect projects={projects} />);
  18. await selectEvent.select(screen.getByRole('textbox'), 'my-proj');
  19. await userEvent.click(screen.getByRole('button', {name: 'Next'}));
  20. expect(windowAssignMock).toHaveBeenCalledWith(
  21. `${window.location.origin}/extensions/aws_lambda/setup/?projectId=53`
  22. );
  23. });
  24. });