it('should render loader when not authenticated', () => {
     const WrappedRoute = privateRoute(PrivatePage);
     const store = initStore();
     const component = mount(<WrappedRoute store={store}/>);

     expect(component.find('.loader').length).toEqual(1);
   });
   it('should render the page when authenticated', () => {
     const WrappedRoute = privateRoute(PrivatePage);
     const store = initStore({authentication: {isAuthenticated: true}});
     const component = mount(<WrappedRoute store={store}/>);

     expect(component.find('.loader').length).toEqual(0);
   });
Пример #3
0
export default (onLogout) => (
  <Route path="/" name="app" component={App}>
    <IndexRoute component={SimpleListComponent}/>
    <Route path="private" component={privateRoute(PrivatePage)}/>
    <Route path="login" component={LoginForm}/>
    <Route path="logout" onEnter={onLogout}/>
    <Route path="usersystem" component={UserSystem}>
        <Route path="user" component={UserManagementPage}/>
    </Route>
    <Route path="register" component={RegisterPage}/>
  </Route>
);