apiTokenRow.spec.jsx 735 B

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