{"size": 1292, "ext": "js", "max_stars_repo_path": "src/components/Header/__tests__/DesktopNav.test.js", "max_stars_repo_name": "x5engine/react-time-tracking", "max_stars_repo_stars_event_min_datetime": "2017-06-30T12:07:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-11T21:11:22.000Z", "max_issues_repo_path": "src/components/Header/__tests__/DesktopNav.test.js", "max_issues_repo_name": "x5engine/react-time-tracking", "max_issues_repo_issues_event_min_datetime": "2017-02-15T09:25:46.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-11T07:38:34.000Z", "max_forks_repo_path": "src/components/Header/__tests__/DesktopNav.test.js", "max_forks_repo_name": "x5engine/react-time-tracking", "max_forks_repo_forks_event_min_datetime": "2017-11-12T19:42:49.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T03:30:07.000Z"}
{"max_stars_count": 61, "max_issues_count": 4, "max_forks_count": 27, "avg_line_length": 24.3773584906, "max_line_length": 67, "alphanum_fraction": 0.6640866873}
import React from 'react'
import {mount} from 'enzyme'

import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';

import {createStore} from 'redux'
import {Provider} from 'react-redux'

import DesktopNav from '../DesktopNav'

import FlatButton from 'material-ui/FlatButton'
import LoggedInMenu from '../../../containers/Header/LoggedInMenu'

// Needed for onTouchTap
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();

describe('<DesktopNav />', () => {
  const setup = (userLoggedIn) => {
    //FIXME: check if we need store here
    const emptyReducer = (state = {}, action) => (state)
    const store = createStore(emptyReducer)

    const wrapper = mount(
      <Provider store={store}>
        <MuiThemeProvider>
          <DesktopNav userLoggedIn={userLoggedIn} />
        </MuiThemeProvider>
      </Provider>
    )
    return wrapper
  }

  it ('logged in', () => {
    const wrapper = setup(true)
    
    //two menu buttons
    expect(wrapper.find(FlatButton).length).toBe(2)
    expect(wrapper.find(LoggedInMenu).length).toBe(1)
    
  })

  it ('guest', () => {

    const wrapper = setup(false)
    //1 login button
    expect(wrapper.find(FlatButton).length).toBe(2)
    expect(wrapper.find(LoggedInMenu).length).toBe(0)
    
  })

})
