Repository URL to install this package:
|
Version:
8.1.0-rc.5 ▾
|
import React from 'react';
import { mount } from 'enzyme';
import HeaderWidget from './HeaderWidget';
import userData from '../../structure/Navigation/fixture';
describe('HeaderWidget', () => {
it('should match the snapshot', () => {
const component = mount(<HeaderWidget />);
expect(component.getElement()).toMatchSnapshot();
});
it('should render a UserMenu if the user is logged in', () => {
const component = mount(<HeaderWidget user={userData} />);
expect(component.contains('UserMenu'));
});
it('should render a login and signup button if a user is not logged in', () => {
const component = mount(<HeaderWidget />);
expect(component.find('.HeaderWidget-loginButton'));
expect(component.find('.HeaderWidget-signupButton'));
});
it('should render a UserMenu with user avatar and name if user is logged in', () => {
const component = mount(<HeaderWidget user={userData} />);
expect(component.find('.UserAvatar-avatar'));
expect(component.find('.UserArea-userName'));
});
});