settingsLayout.spec.jsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React from 'react';
  2. import {shallow} from 'enzyme';
  3. import {Client} from 'app/api';
  4. import SettingsLayout from 'app/views/settings/components/settingsLayout';
  5. describe('SettingsLayout', function() {
  6. beforeEach(function() {
  7. Client.clearMockResponses();
  8. Client.addMockResponse({
  9. url: '/internal/health/',
  10. body: {
  11. problems: [],
  12. },
  13. });
  14. Client.addMockResponse({
  15. url: '/organizations/',
  16. body: [TestStubs.Organization()],
  17. });
  18. Client.addMockResponse({
  19. url: '/organizations/org-slug/',
  20. method: 'DELETE',
  21. statusCode: 401,
  22. body: {
  23. sudoRequired: true,
  24. },
  25. });
  26. Client.addMockResponse({
  27. url: '/authenticators/',
  28. body: [],
  29. });
  30. });
  31. it('renders', function() {
  32. let wrapper = shallow(<SettingsLayout route={{}} routes={[]} />);
  33. expect(wrapper).toMatchSnapshot();
  34. });
  35. it('can render navigation', function() {
  36. const Navigation = () => <div>Navigation</div>;
  37. let wrapper = shallow(
  38. <SettingsLayout route={{}} routes={[]} renderNavigation={() => <Navigation />} />
  39. );
  40. expect(wrapper.find('Navigation')).toHaveLength(1);
  41. });
  42. });