AddDataSourcePermissions.test.tsx 682 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { AddDataSourcePermissions, Props } from './AddDataSourcePermissions';
  4. import { AclTarget } from '../../types/acl';
  5. const setup = () => {
  6. const props: Props = {
  7. onAddPermission: jest.fn(),
  8. onCancel: jest.fn(),
  9. };
  10. return shallow(<AddDataSourcePermissions {...props} />);
  11. };
  12. describe('Render', () => {
  13. it('should render component', () => {
  14. const wrapper = setup();
  15. expect(wrapper).toMatchSnapshot();
  16. });
  17. it('should render user picker', () => {
  18. const wrapper = setup();
  19. wrapper.instance().setState({ type: AclTarget.User });
  20. expect(wrapper).toMatchSnapshot();
  21. });
  22. });