<commit_before>
import {expect} from 'chai';
import {List, Map} from 'immutable'

describe('immutability', () => {
  //learning test
  describe('is a number', () => {

    function increment(currentState) {
      return currentState + 1;
    }

    it('is immutable', () => {
      let state = 42;
      let nextNumber = increment(state);

      expect(nextNumber).to.equal(43);
      expect(state).to.equal(42);
    });
  });

  //List test
  describe('A List', () => {
    function AddMovie(currentState, movie) {
      return currentState.push(movie);
    }

    it('is immutable', () => {
      let state = List.of('Transporting', '28 Days Later');
      let nextState = AddMovie(state, 'Sunshine');

      expect(nextState).to.equal(List.of(
        'Transporting',
        '28 Days Later',
        'Sunshine'
      ));

      expect(state).to.equal(List.of('Transporting', '28 Days Later'));
    });
  });

  //Map test
  describe('a tree', () => {

    function addMovie(currentState, movie) {
      return currentState.set(
        'movies',
        currentState.get('movies').push(movie)
      );
    }

    it('is immutable', () => {
      let state = Map({
        movies: List.of('Trainspotting', '28 Days Later')
      });
      let nextState = addMovie(state, 'Sunshine');

      expect(nextState).to.equal(Map({
        movies: List.of(
          'Trainspotting',<commit_msg>update immutibility test of immutablejs<commit_after>
import {expect} from 'chai';
import {List, Map} from 'immutable'

describe('immutability', () => {
  //learning test
  describe('is a number', () => {

    function increment(currentState) {
      return currentState + 1;
    }

    it('is immutable', () => {
      let state = 42;
      let nextNumber = increment(state);

      expect(nextNumber).to.equal(43);
      expect(state).to.equal(42);
    });
  });

  //List test
  describe('A List', () => {
    function AddMovie(currentState, movie) {
      return currentState.push(movie);
    }

    it('is immutable', () => {
      let state = List.of('Transporting', '28 Days Later');
      let nextState = AddMovie(state, 'Sunshine');

      expect(nextState).to.equal(List.of(
        'Transporting',
        '28 Days Later',
        'Sunshine'
      ));

      expect(state).to.equal(List.of('Transporting', '28 Days Later'));
    });
  });

  //Map test
  describe('a tree', () => {

    function addMovie(currentState, movie) {
      /*return currentState.set(
        'movies',
        currentState.get('movies').push(movie)
      );*/

      return currentState.update('movies', movies => movies.push(movie));
    }

    it('is immutable', () => {
      let state = Map({
        movies: List.of('Trainspotting', '28 Days Later')
      });
      let nextState = addMovie(state, 'Sunshine');

      expect(nextState).to.equal(Map({
        movies: List.of(
          'Trainspotting',
{'fraction_non_alphanumeric': 0.16776429809358753, 'fraction_numerical': 0.010398613518197574, 'mean_word_length': 2.5498154981549814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '4001603', 'n_tokens_mistral': 942, 'n_tokens_neox': 891, 'n_words': 189}