<commit_before>import React from 'react';
import { mount } from 'enzyme';
import chai, {expect} from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import { createStore } from 'redux';
import rootReducer from '../reducers/rootReducer';
import initialState from '../reducers/initialState';
import { Provider } from 'react-redux';
import { Navbar } from './Navbar';

chai.use(sinonChai);

describe('<Navbar />', () => {

  let store;

  beforeEach(() => {
    store = createStore(rootReducer, initialState);
  });

  it('should render Login when isAuthenticated is false', () => {
    const props = {
      isAuthenticated: false,
      username: 'test',
      isAdmin: true,
      cartCount: 1,
      login: () => null,
      logout: () => null
    };

    const wrapper = mount(
      <Provider store={store}>
          <Navbar {...props} />
      </Provider>
    );
    const loginButton = wrapper.find('Login');

    expect(loginButton.length).to.equal(1);
  });

  it('should render Logout when isAuthenticated is true', () => {
    const props = {
      isAuthenticated: true,
      username: 'test',
      isAdmin: true,
      cartCount: 1,
      login: () => null,
      logout: () => null
    };

    const wrapper = mount(
      <Provider store={store}>
          <Navbar {...props} />
      </Provider>
    );

    const logoutButton = wrapper.find('Logout');

    expect(logoutButton.length).to.equal(1);
  });
});<commit_msg>more spec cleanup<commit_after>import React from 'react';
import { mount } from 'enzyme';
import {expect} from 'chai';
import { createStore } from 'redux';
import rootReducer from '../reducers/rootReducer';
import initialState from '../reducers/initialState';
import { Provider } from 'react-redux';
import Navbar from './Navbar'; // eslint-disable-line import/no-named-as-default

const ExampleToken = "<KEY>";

describe('<Navbar />', () => {

  let store;

  beforeEach(() => {
    store = createStore(rootReducer, initialState);
  });

  it('should render Login when isAuthenticated is false', () => {
    const props = {
      login: () => null,
      logout: () => null
    };

    const wrapper = mount(
      <Provider store={store}>
          <Navbar {...props} />
      </Provider>
    );
    const loginButton = wrapper.find('Login');

    expect(loginButton.length).to.equal(1);
  });

  it('should render Logout when isAuthenticated is true', () => {
    const props = {
      login: () => null,
      logout: () => null
    };

    store.dispatch({ type: "LOGIN_SUCCESS", token: ExampleToken, username: 'test', roles: [] });

    const wrapper = mount(
      <Provider store={store}>
          <Navbar {...props} />
      </Provider>
    );

    const logoutButton = wrapper.find('Logout');

    expect(logoutButton.length).to.equal(1);
  });
});
{'fraction_non_alphanumeric': 0.16566158212131962, 'fraction_numerical': 0.002128414331323164, 'mean_word_length': 2.8736263736263736, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5976109', 'n_tokens_mistral': 891, 'n_tokens_neox': 853, 'n_words': 219}