diff --git a/__tests__/App.test.jsx b/__tests__/App.test.jsx
index 7b98adafff..cbffd97f86 100644
--- a/__tests__/App.test.jsx
+++ b/__tests__/App.test.jsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { HashRouter as Router } from 'react-router-dom';
+import { MemoryRouter } from 'react-router-dom';
import { shallow, mount } from 'enzyme';
import App from '../src/App';
import api from '../src/api';
@@ -7,10 +7,6 @@ import { API_LOGOUT } from '../src/endpoints';
import Dashboard from '../src/pages/Dashboard';
import Login from '../src/pages/Login';
-import { asyncFlush } from '../jest.setup';
-
-const DEFAULT_ACTIVE_GROUP = 'views_group';
-const DEFAULT_ACTIVE_ITEM = 'views_group_dashboard';
describe('', () => {
test('renders without crashing', () => {
@@ -22,7 +18,7 @@ describe('', () => {
api.isAuthenticated = jest.fn();
api.isAuthenticated.mockReturnValue(false);
- const appWrapper = mount();
+ const appWrapper = mount();
const login = appWrapper.find(Login);
expect(login.length).toBe(1);
@@ -34,7 +30,7 @@ describe('', () => {
api.isAuthenticated = jest.fn();
api.isAuthenticated.mockReturnValue(true);
- const appWrapper = mount();
+ const appWrapper = mount();
const dashboard = appWrapper.find(Dashboard);
expect(dashboard.length).toBe(1);
@@ -49,24 +45,15 @@ describe('', () => {
expect(appWrapper.state().isNavOpen).toBe(false);
});
- test('onLogoClick sets selected nav back to defaults', () => {
- const appWrapper = shallow();
- appWrapper.setState({ activeGroup: 'foo', activeItem: 'bar' });
- expect(appWrapper.state().activeItem).toBe('bar');
- expect(appWrapper.state().activeGroup).toBe('foo');
- appWrapper.instance().onLogoClick();
- expect(appWrapper.state().activeGroup).toBe(DEFAULT_ACTIVE_GROUP);
- });
-
test('api.logout called from logout button', async () => {
+ const logOutButtonSelector = 'button[aria-label="Logout"]';
api.get = jest.fn().mockImplementation(() => Promise.resolve({}));
- const appWrapper = shallow();
- appWrapper.instance().onDevLogout();
+ const appWrapper = mount();
+ const logOutButton = appWrapper.find(logOutButtonSelector);
+ expect(logOutButton.length).toBe(1);
+ logOutButton.simulate('click');
appWrapper.setState({ activeGroup: 'foo', activeItem: 'bar' });
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(API_LOGOUT);
- await asyncFlush();
- expect(appWrapper.state().activeItem).toBe(DEFAULT_ACTIVE_ITEM);
- expect(appWrapper.state().activeGroup).toBe(DEFAULT_ACTIVE_GROUP);
});
});
diff --git a/__tests__/components/TowerLogo.test.jsx b/__tests__/components/TowerLogo.test.jsx
index 3bd40afaee..10e3461443 100644
--- a/__tests__/components/TowerLogo.test.jsx
+++ b/__tests__/components/TowerLogo.test.jsx
@@ -43,20 +43,6 @@ describe('', () => {
expect(towerLogoElem.props().history.length).toBe(2);
});
- test('gracefully handles not being passed click handler', () => {
- logoWrapper = mount(
-
-
-
-
-
- );
- 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(
diff --git a/src/App.jsx b/src/App.jsx
index 38465599d8..3b03de3382 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -81,13 +81,8 @@ class App extends React.Component {
this.setState(({ isNavOpen }) => ({ isNavOpen: !isNavOpen }));
};
- onLogoClick = () => {
- this.setState({ activeGroup: 'views_group' });
- }
-
onDevLogout = async () => {
await api.get(API_LOGOUT);
- this.setState({ activeGroup: 'views_group', activeItem: 'views_group_dashboard' });
}
render () {
@@ -134,7 +129,7 @@ class App extends React.Component {
}
+ logo={}
toolbar={PageToolbar}
showNavToggle
onNavToggle={this.onNavToggle}
diff --git a/src/components/TowerLogo/TowerLogo.jsx b/src/components/TowerLogo/TowerLogo.jsx
index 082777ba7e..6b9d0e3a30 100644
--- a/src/components/TowerLogo/TowerLogo.jsx
+++ b/src/components/TowerLogo/TowerLogo.jsx
@@ -15,13 +15,8 @@ class TowerLogo extends Component {
}
onClick = () => {
- const { history, onClick: handleClick } = this.props;
-
- if (!handleClick) return;
-
+ const { history } = this.props;
history.push('/');
-
- handleClick();
};
onHover = () => {