<commit_before>import {expect} from 'chai';
import {List, Map} from 'immutable';
import {loadEntriesInto, next} from '../src/core';

describe('core logic', () => {

  describe('load entries produces new state ', () => {

    it('from immutable', () => {
      const state = new Map();

      const entries = (List.of(
        'trainspotting',
        '28 days later'
      ));

      const nextState = loadEntriesInto(state, entries);

      expect(nextState).to.equal(new Map({
        entries: List.of(
          'trainspotting',
          '28 days later'
        )}));
    });

    it('from iterable', () => {
      const state = new Map();

      const entries = [
        'trainspotting',
        '28 days later'
      ];

      const nextState = loadEntriesInto(state, entries);

      expect(nextState).to.equal(new Map({
        entries: List.of(
          'trainspotting',
          '28 days later'
        )}));
    });
  });

  describe('next', () => {

    it('takes the next 2 entries on which to vote', () => {
      const state = new Map({
        entries: List.of(
          'trainspotting',
          '28 days later',
          'sunshine'
        )
      });

      const nextState = next(state);

      expect(nextState).to.equal(new Map({
        vote: Map({
          pair: List.of('trainspotting', '28 days later')
        }),
        entries: List.of('sunshine')
      }));
    });
  });
});<commit_msg>refactor for legibility<commit_after>import {expect} from 'chai';
import {List, Map} from 'immutable';
import {loadEntriesInto, next} from '../src/core';

describe('core logic', () => {

  describe('load entries produces new state ', () => {

    it('from immutable', () => {
      const state = new Map();

      const entries = (List.of(
        'trainspotting',
        '28 days later'
      ));

      const nextState = loadEntriesInto(state, entries);

      expect(nextState).to.equal(new Map({
        entries: List.of(
          'trainspotting',
          '28 days later'
        )}));
    });

    it('from iterable', () => {
      const state = new Map();

      const entries = [
        'trainspotting',
        '28 days later'
      ];

      const nextState = loadEntriesInto(state, entries);

      expect(nextState).to.equal(new Map({
        entries: List.of(
          'trainspotting',
          '28 days later'
        )}));
    });
  });

  describe('next', () => {

    it('takes the next 2 entries on which to vote', () => {
      const state = new Map({
        entries: List.of(
          'trainspotting',
          '28 days later',
          'sunshine'
        )
      });

      const nextState = next(state);

      expect(nextState).to.equal(new Map({
        vote: new Map({pair: List.of('trainspotting', '28 days later')}),
        entries: List.of('sunshine')
      }));
    });
  });
});
{'fraction_non_alphanumeric': 0.16104078762306612, 'fraction_numerical': 0.009142053445850914, 'mean_word_length': 2.0010548523206753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1602356', 'n_tokens_mistral': 874, 'n_tokens_neox': 834, 'n_words': 212}