Repository URL to install this package:
|
Version:
7.13.0-rc.7 ▾
|
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();
});
});