apiTokenRow.spec.jsx 762 B

1234567891011121314151617181920212223242526
  1. import React from 'react';
  2. import {shallow, mountWithTheme} from 'sentry-test/enzyme';
  3. import ApiTokenRow from 'app/views/settings/account/apiTokenRow';
  4. describe('ApiTokenRow', function() {
  5. it('renders', function() {
  6. const wrapper = shallow(
  7. <ApiTokenRow onRemove={() => {}} token={TestStubs.ApiToken()} />,
  8. TestStubs.routerContext()
  9. );
  10. // Should be loading
  11. expect(wrapper).toMatchSnapshot();
  12. });
  13. it('calls onRemove callback when trash can is clicked', function() {
  14. const cb = jest.fn();
  15. const wrapper = mountWithTheme(
  16. <ApiTokenRow onRemove={cb} token={TestStubs.ApiToken()} />,
  17. TestStubs.routerContext()
  18. );
  19. wrapper.find('Button').simulate('click');
  20. expect(cb).toHaveBeenCalled();
  21. });
  22. });