<commit_before>import '../../testHelper';

import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-addons-test-utils';
import EmptyWeek from '../../../app/assets/javascripts/components/timeline/empty_week.cjsx';

const makeSpacesUniform = (str) => { return str.replace(/\s{1,}/g, ' '); };

describe('EmptyWeek', () => {
  describe('empty state', () => {
    const TestEmptyWeek = ReactTestUtils.renderIntoDocument(
      <EmptyWeek />
    );
    it('gives the empty text if timeline and edit permissions are empty', () => {
      const headline = ReactTestUtils.findRenderedDOMComponentWithTag(TestEmptyWeek, 'h1');
      const h1 = ReactDOM.findDOMNode(headline);
      return expect(h1.textContent).to.eq('No activity this week');
    });
  });

  describe('timeline is empty, edit permissions', () => {
    const TestEmptyWeek = ReactTestUtils.renderIntoDocument(
      <EmptyWeek
        empty_timeline
        edit_permissions
      />
    );
    it('suggests editing the week', () => {
      const pTag = ReactTestUtils.scryRenderedDOMComponentsWithTag(TestEmptyWeek, 'p')[0];
      expect(makeSpacesUniform(pTag.textContent)).to.eq(
        makeSpacesUniform('To get started, start editing this week or start from a prebuilt assignment.')
      );
    });
  });<commit_msg>Fix EmptyWeek spec<commit_after>import '../../testHelper';

import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-addons-test-utils';
import EmptyWeek from '../../../app/assets/javascripts/components/timeline/empty_week.jsx';

const makeSpacesUniform = (str) => { return str.replace(/\s{1,}/g, ' '); };

describe('EmptyWeek', () => {
  const course = { slug: 'my_course' };

  describe('empty state', () => {
    const TestEmptyWeek = ReactTestUtils.renderIntoDocument(
      <EmptyWeek />
    );
    it('gives the empty text if timeline and edit permissions are empty', () => {
      const headline = ReactTestUtils.findRenderedDOMComponentWithTag(TestEmptyWeek, 'h1');
      const h1 = ReactDOM.findDOMNode(headline);
      return expect(h1.textContent).to.eq('No activity this week');
    });
  });

  describe('timeline is empty, edit permissions', () => {
    const TestEmptyWeek = ReactTestUtils.renderIntoDocument(
      <EmptyWeek
        empty_timeline
        edit_permissions
        course={course}
      />
    );
    it('suggests editing the week', () => {
      const pTag = ReactTestUtils.scryRenderedDOMComponentsWithTag(TestEmptyWeek, 'p')[0];
      expect(makeSpacesUniform(pTag.textContent)).to.eq(
        makeSpacesUniform('To get started, start editing this week or start from a prebuilt assignment.')
      );
    });
  });
{'fraction_non_alphanumeric': 0.14185445142223865, 'fraction_numerical': 0.003694126339120798, 'mean_word_length': 3.574324324324324, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '4143383', 'n_tokens_mistral': 806, 'n_tokens_neox': 794, 'n_words': 179}