Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/components / user / UserMenu / UserMenu.spec.js
Size: Mime:
import React from 'react';
import { mount, shallow } from 'enzyme';
import UserMenu from './UserMenu';
import Menu from '../../controls/Menu';

describe('UserMenu', () => {
  it('should match the snapshot', () => {
    const component = mount(<UserMenu />);
    expect(component.getElement()).toMatchSnapshot();
  });

  it('should include a link to Admin Settings if logged in user is an org admin', () => {
    const component = shallow(<UserMenu isOrgAdmin />);
    expect(
      component
        .find(Menu)
        .shallow()
        .find('.Menu-item').length
    ).toBe(5);
  });

  it('should call handleClickLogout when clicked', () => {
    const handleClickLogoutSpy = jest.fn();
    const component = shallow(<UserMenu onClickLogout={handleClickLogoutSpy} />);
    component.instance().handleClickLogout();
    expect(handleClickLogoutSpy).toHaveBeenCalled();
  });
});