<commit_before>import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';
import { project, workflow } from '../dev-classifier/mock-data';
import ProjectPage from './project-page';

function Page() {
  return (
    <p>Hello world!</p>
  );
}

describe('ProjectPage', () => {
  const background = {
    src: 'the project background image url'
  };

  it('should render without crashing', () => {
    shallow(<ProjectPage><Page /></ProjectPage>);
  });

  it('should render the project nav bar', () => {
    const wrapper = shallow(<ProjectPage><Page /></ProjectPage>);
    const navElement = wrapper.find('ProjectNavbar').first();
    expect(navElement).to.have.lengthOf(1);
  });

  it('should pass background, project and workflow props to its children', () => {
    const wrapper = shallow(<ProjectPage background={background} project={project} workflow={workflow}><Page /></ProjectPage>);
    const child = wrapper.find('Page');
    expect(child.props().background).to.equal(background);
    expect(child.props().project).to.equal(project);
    expect(child.props().workflow).to.equal(workflow);
  });

  describe('with a launch-approved project', () => {
    project.launch_approved = true;
    const wrapper = shallow(<ProjectPage project={project} ><Page /></ProjectPage>);
    const disclaimer = wrapper.find('Translate[className="project-disclaimer"]');
    it('should not render the Zooniverse disclaimer.', () => {
      expect(disclaimer).to.have.lengthOf(0);
    });
  });

  describe('without approval', () => {
    project.launch_approved = false;
    const wrapper = shallow(<ProjectPage project={project} ><Page /></ProjectPage>);
    const disclaimer = wrapper.find('Translate[className="project-disclaimer"]');
    it('should render the Zooniverse disclaimer.', () => {
      expect(disclaimer).to.have.lengthOf(1);
    });
    it('should render the disclaimer immediately after its children.', () => {
      expect(wrapper.childAt(1).name()).to.equal('Page');
      expect(wrapper.childAt(2)).to.deep.equal(disclaimer);
    });
  });

  describe('on the home page', () => {
    it('should not show the project navigation');
    it('should not show any project announcements');
    it('should not show the field guide');
  });

  describe('on other project pages', () =>{
    it('should show the project navigation');
    it('should show any project announcements');
    it('should show the field guide');
  });
});<commit_msg>Field guide tests<commit_after>import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';
import { project, workflow } from '../dev-classifier/mock-data';
import ProjectPage from './project-page';

function Page() {
  return (
    <p>Hello world!</p>
  );
}

describe('ProjectPage', () => {
  const background = {
    src: 'the project background image url'
  };

  it('should render without crashing', () => {
    shallow(<ProjectPage><Page /></ProjectPage>);
  });

  it('should render the project nav bar', () => {
    const wrapper = shallow(<ProjectPage><Page /></ProjectPage>);
    const navElement = wrapper.find('ProjectNavbar').first();
    expect(navElement).to.have.lengthOf(1);
  });

  it('should pass background, project and workflow props to its children', () => {
    const wrapper = shallow(<ProjectPage background={background} project={project} workflow={workflow}><Page /></ProjectPage>);
    const child = wrapper.find('Page');
    expect(child.props().background).to.equal(background);
    expect(child.props().project).to.equal(project);
    expect(child.props().workflow).to.equal(workflow);
  });

  describe('with a launch-approved project', () => {
    project.launch_approved = true;
    const wrapper = shallow(<ProjectPage project={project} ><Page /></ProjectPage>);
    const disclaimer = wrapper.find('Translate[className="project-disclaimer"]');
    it('should not render the Zooniverse disclaimer.', () => {
      expect(disclaimer).to.have.lengthOf(0);
    });
  });

  describe('without approval', () => {
    project.launch_approved = false;
    const wrapper = shallow(<ProjectPage project={project} ><Page /></ProjectPage>);
    const disclaimer = wrapper.find('Translate[className="project-disclaimer"]');
    it('should render the Zooniverse disclaimer.', () => {
      expect(disclaimer).to.have.lengthOf(1);
    });
    it('should render the disclaimer immediately after its children.', () => {
      expect(wrapper.childAt(1).name()).to.equal('Page');
      expect(wrapper.childAt(2)).to.deep.equal(disclaimer);
    });
  });

  describe('on the home page', () => {
    let wrapper;
    beforeEach(() => {
      project.slug = 'test/project';
      const mockLocation = {
        pathname: `/projects/${project.slug}`
      };
      wrapper = shallow(<ProjectPage location={mockLocation} project={project} ><Page /></ProjectPage>);
    });
    it('should not show the project navigation');
    it('should not show any project announcements');
    it('should not show the field guide', () => {
      const fieldguide = wrapper.find('PotentialFieldGuide');
      expect(fieldguide).to.have.lengthOf(0);
    });
  });

  describe('on other project pages', () => {
    let wrapper;
    beforeEach(() => {
      project.slug = 'test/project';
      const mockLocation = {
        pathname: `/projects/${project.slug}/about`
      };
      wrapper = shallow(<ProjectPage location={mockLocation} project={project} ><Page /></ProjectPage>);
    });
    it('should show the project navigation');
    it('should show any project announcements');
    it('should show the field guide', () => {
      const fieldguide = wrapper.find('PotentialFieldGuide');
      expect(fieldguide).to.have.lengthOf(1);
    });
  });
});
{'fraction_non_alphanumeric': 0.17236590869640686, 'fraction_numerical': 0.0020829717063009894, 'mean_word_length': 3.9038297872340424, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 69, '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': '2256442', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1587, 'n_words': 380}