awsLambdaProjectSelect.spec.jsx 917 B

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