apiTokenRow.spec.jsx 648 B

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