apiTokenRow.spec.jsx 669 B

123456789101112131415161718192021222324
  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. );
  8. // Should be loading
  9. expect(wrapper).toSnapshot();
  10. });
  11. it('calls onRemove callback when trash can is clicked', function () {
  12. const cb = jest.fn();
  13. const wrapper = mountWithTheme(
  14. <ApiTokenRow onRemove={cb} token={TestStubs.ApiToken()} />
  15. );
  16. wrapper.find('Button').simulate('click');
  17. expect(cb).toHaveBeenCalled();
  18. });
  19. });