awsLambdaProjectSelect.spec.jsx 962 B

123456789101112131415161718192021222324252627282930
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {selectByValue} from 'sentry-test/select-new';
  3. import AwsLambdaProjectSelect from 'sentry/views/integrationPipeline/awsLambdaProjectSelect';
  4. describe('AwsLambdaProjectSelect', () => {
  5. let projects;
  6. let wrapper;
  7. let windowAssignMock;
  8. beforeEach(() => {
  9. windowAssignMock = jest.fn();
  10. window.location.assign = windowAssignMock;
  11. projects = [
  12. TestStubs.Project(),
  13. TestStubs.Project({id: '53', name: 'My Proj', slug: 'my-proj'}),
  14. ];
  15. wrapper = mountWithTheme(<AwsLambdaProjectSelect projects={projects} />);
  16. });
  17. it('submit project', () => {
  18. selectByValue(wrapper, '53', {name: 'projectId', control: true});
  19. wrapper.find('StyledButton[aria-label="Next"]').simulate('click');
  20. const {
  21. location: {origin},
  22. } = window;
  23. expect(windowAssignMock).toHaveBeenCalledWith(
  24. `${origin}/extensions/aws_lambda/setup/?projectId=53`
  25. );
  26. });
  27. });