addIntegrationButton.spec.jsx 840 B

123456789101112131415161718192021222324252627
  1. /* global global */
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import AddIntegrationButton from 'sentry/views/organizationIntegrations/addIntegrationButton';
  4. describe('AddIntegrationButton', function () {
  5. const provider = TestStubs.GitHubIntegrationProvider();
  6. it('Opens the setup dialog on click', function () {
  7. const onAdd = jest.fn();
  8. const focus = jest.fn();
  9. const open = jest.fn().mockReturnValue({focus});
  10. global.open = open;
  11. const wrapper = mountWithTheme(
  12. <AddIntegrationButton provider={provider} onAddIntegration={onAdd} />
  13. );
  14. wrapper.find('Button').simulate('click');
  15. expect(open.mock.calls).toHaveLength(1);
  16. expect(focus.mock.calls).toHaveLength(1);
  17. expect(open.mock.calls[0][2]).toBe(
  18. 'scrollbars=yes,width=100,height=100,top=334,left=462'
  19. );
  20. });
  21. });