<commit_before>import { map } from 'lodash';
import { shallow } from 'enzyme';
import { Wrapper, SnapShot } from '../helpers/component-testing';
import UserActionsMenu from '../../../src/components/navbar/actions-menu';
import { setupStores, resetStores, courseModel } from './spec-test-params';
import FakeWindow from 'shared/specs/helpers/fake-window';

const testWithRole = roleType =>

  function() {
    let props;
    let roleTestParams;

    beforeEach(function() {
      roleTestParams = setupStores(roleType);
      return (
        props = {
          courseId: courseModel.id,
          windowImpl: new FakeWindow,
        }
      );
    });

    afterEach(() => resetStores(roleType));

    it('has actions menu that matches snapshot', function() {
      expect(SnapShot.create(
        <Wrapper _wrapped_component={UserActionsMenu}  {...props} />).toJSON()
      ).toMatchSnapshot();
    });

    it('should have link to browse the book', () => {
      const menu = shallow(<UserActionsMenu {...props} />);
      expect(menu).toHaveRendered('BrowseBookMenuItem');
    });

    it('should have performance forecast menu', () => {
      const menu = shallow(<UserActionsMenu {...props} />);
      expect(menu).toHaveRendered('[data-name="viewPerformanceGuide"]');
    });
  };


describe('Student Navbar Component', testWithRole('student'));

describe('Teacher Navbar Component', testWithRole('teacher'));
<commit_msg>update specs for user actions<commit_after>import { map } from 'lodash';
import { shallow } from 'enzyme';
import { Wrapper, SnapShot } from '../helpers/component-testing';
import UserActionsMenu from '../../../src/components/navbar/actions-menu';
import { setupStores, resetStores, courseModel } from './spec-test-params';
import FakeWindow from 'shared/specs/helpers/fake-window';

const testWithRole = roleType =>

  function() {
    let props;
    let roleTestParams;

    beforeEach(function() {
      roleTestParams = setupStores(roleType);
      return (
        props = {
          courseId: courseModel.id,
          windowImpl: new FakeWindow,
        }
      );
    });

    afterEach(() => resetStores(roleType));

    it('has actions menu that matches snapshot', function() {
      expect(SnapShot.create(
        <Wrapper _wrapped_component={UserActionsMenu}  {...props} />).toJSON()
      ).toMatchSnapshot();
    });

    it('should have link to browse the book', () => {
      const menu = mount(<Wrapper _wrapped_component={UserActionsMenu}  {...props} />);
      expect(menu).toHaveRendered('BrowseBookMenuItem');
    });

    it('should have performance forecast menu', () => {
      const menu = mount(<Wrapper _wrapped_component={UserActionsMenu}  {...props} />);
      expect(menu).toHaveRendered('[data-name="viewPerformanceGuide"]');
    });
  };


describe('Student Navbar Component', testWithRole('student'));

describe('Teacher Navbar Component', testWithRole('teacher'));

{'fraction_non_alphanumeric': 0.15358361774744028, 'fraction_numerical': 0.0, 'mean_word_length': 3.420814479638009, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '3221289', 'n_tokens_mistral': 870, 'n_tokens_neox': 828, 'n_words': 186}