<commit_before>import React from 'react';
import { render } from '../../../helpers/rendering.js';
import App, { AddTodo, TodoList } from './setup.js';


describe('App', function() {
  describe('adding new todos', function() {
    beforeEach(function() {
      render(<App />);
    });

    it('should render the add new todo field', function() {
      expect(AddTodo).to.have.been.rendered;
    });

    it('should render the new todo', function() {
      AddTodo.props.addTodo({ title: 'buy milk' });

      expect(TodoList).to.have.been.renderedWith({
        todos: [{ title: 'buy milk', completed: false }]
      });
    });

    it('should trim whitespace from new todos', function() {
      AddTodo.props.addTodo({ title: '   wash car   ' });

      expect(TodoList).to.have.been.renderedWith({
        todos: [{ title: 'wash car', completed: false }]
      });
    });

    it('should not add an empty todo', function() {
      AddTodo.props.addTodo({ title: '' });

      expect(TodoList).to.not.have.been.renderedWith({
        todos: [{ title: '', completed: false }]
      });
    });
  });
});
<commit_msg>Remove duplicated expectations<commit_after>import React from 'react';
import { render } from '../../../helpers/rendering.js';
import App, { AddTodo, TodoList } from './setup.js';
import { match } from 'sinon';


describe('App', function() {
  describe('adding new todos', function() {
    beforeEach(function() {
      render(<App />);
    });

    it('should render the add new todo field', function() {
      expect(AddTodo).to.have.been.rendered;
    });

    it('should render the new todo', function() {
      AddTodo.props.addTodo({ title: 'buy milk' });

      expect(TodoList).to.have.been.renderedWith({
        todos: [checkTodoTitle('buy milk')]
      });
    });

    it('should mark the new todo as active', function() {
      AddTodo.props.addTodo({ title: 'buy more milk' });

      expect(TodoList).to.have.been.renderedWith({
        todos: [match({ completed: false })]
      });
    });

    it('should trim whitespace from new todos', function() {
      AddTodo.props.addTodo({ title: '   wash car   ' });

      expect(TodoList).to.have.been.renderedWith({
        todos: [checkTodoTitle('wash car')]
      });
    });

    it('should not add an empty todo', function() {
      AddTodo.props.addTodo({ title: '' });

      expect(TodoList).to.not.have.been.renderedWith({
        todos: [checkTodoTitle('')]
      });
    });
  });
});

function checkTodoTitle(title) {
  return match(todo => todo.title === title, title);
}

{'fraction_non_alphanumeric': 0.1797270955165692, 'fraction_numerical': 0.0, 'mean_word_length': 2.807121661721068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '6711759', 'n_tokens_mistral': 835, 'n_tokens_neox': 804, 'n_words': 183}