add unit test coverage for TowerLogo.jsx

This commit is contained in:
Jake McDermott
2019-01-07 07:30:58 -05:00
parent 4936238344
commit 8756da59fa
4 changed files with 21 additions and 31 deletions

View File

@@ -29,11 +29,10 @@ describe('<TowerLogo />', () => {
});
test('adds navigation to route history on click', () => {
const onLogoClick = jest.fn();
logoWrapper = mount(
<MemoryRouter>
<I18nProvider>
<TowerLogo onClick={onLogoClick} />
<TowerLogo linkTo="/" />
</I18nProvider>
</MemoryRouter>
);
@@ -43,12 +42,26 @@ describe('<TowerLogo />', () => {
expect(towerLogoElem.props().history.length).toBe(2);
});
test('linkTo prop is optional', () => {
logoWrapper = mount(
<MemoryRouter>
<I18nProvider>
<TowerLogo />
</I18nProvider>
</MemoryRouter>
);
findChildren();
expect(towerLogoElem.props().history.length).toBe(1);
logoWrapper.simulate('click');
expect(towerLogoElem.props().history.length).toBe(1);
});
test('handles mouse over and out state.hover changes', () => {
const onLogoClick = jest.fn();
logoWrapper = mount(
<MemoryRouter>
<I18nProvider>
<TowerLogo onClick={onLogoClick} />
<TowerLogo />
</I18nProvider>
</MemoryRouter>
);