awsLambdaProjectSelect.spec.tsx 971 B

12345678910111213141516171819202122232425262728293031
  1. import {ProjectFixture} from 'sentry-fixture/project';
  2. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  3. import selectEvent from 'sentry-test/selectEvent';
  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. });