TeamSettings.test.tsx 741 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { shallow } from 'enzyme';
  2. import React from 'react';
  3. import { Props, TeamSettings } from './TeamSettings';
  4. import { getMockTeam } from './__mocks__/teamMocks';
  5. jest.mock('app/core/core', () => ({
  6. contextSrv: {
  7. hasPermissionInMetadata: () => true,
  8. },
  9. }));
  10. const setup = (propOverrides?: object) => {
  11. const props: Props = {
  12. team: getMockTeam(),
  13. updateTeam: jest.fn(),
  14. };
  15. Object.assign(props, propOverrides);
  16. const wrapper = shallow(<TeamSettings {...props} />);
  17. const instance = wrapper.instance() as any;
  18. return {
  19. wrapper,
  20. instance,
  21. };
  22. };
  23. describe('Render', () => {
  24. it('should render component', () => {
  25. const { wrapper } = setup();
  26. expect(wrapper).toMatchSnapshot();
  27. });
  28. });