OrgDetailsPage.test.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { OrgDetailsPage, Props } from './OrgDetailsPage';
  4. import { NavModel, Organization, OrganizationPreferences } from '../../types';
  5. const setup = (propOverrides?: object) => {
  6. const props: Props = {
  7. preferences: {} as OrganizationPreferences,
  8. organization: {} as Organization,
  9. navModel: {} as NavModel,
  10. loadOrganization: jest.fn(),
  11. loadOrganizationPreferences: jest.fn(),
  12. loadStarredDashboards: jest.fn(),
  13. setOrganizationName: jest.fn(),
  14. updateOrganization: jest.fn(),
  15. };
  16. Object.assign(props, propOverrides);
  17. return shallow(<OrgDetailsPage {...props} />);
  18. };
  19. describe('Render', () => {
  20. it('should render component', () => {
  21. const wrapper = setup();
  22. expect(wrapper).toMatchSnapshot();
  23. });
  24. it('should render organization and preferences', () => {
  25. const wrapper = setup({
  26. organization: {
  27. name: 'Cool org',
  28. id: 1,
  29. },
  30. preferences: {
  31. homeDashboardId: 1,
  32. theme: 'Default',
  33. timezone: 'Default',
  34. },
  35. });
  36. expect(wrapper).toMatchSnapshot();
  37. });
  38. });