narrowLayout.spec.jsx 756 B

1234567891011121314151617181920212223242526
  1. import React from 'react';
  2. import {mount} from 'enzyme';
  3. import NarrowLayout from 'app/components/narrowLayout';
  4. describe('NarrowLayout', function() {
  5. it('renders without logout', function() {
  6. let wrapper = mount(<NarrowLayout />);
  7. expect(wrapper.find('a.logout')).toHaveLength(0);
  8. });
  9. it('renders with logout', function() {
  10. let wrapper = mount(<NarrowLayout showLogout />);
  11. expect(wrapper.find('a.logout')).toHaveLength(1);
  12. });
  13. it('can logout', function() {
  14. let mock = MockApiClient.addMockResponse({
  15. url: '/auth/',
  16. method: 'DELETE',
  17. status: 204,
  18. });
  19. let wrapper = mount(<NarrowLayout showLogout />);
  20. wrapper.find('a.logout').simulate('click');
  21. expect(mock).toHaveBeenCalled();
  22. });
  23. });