<commit_before>import Item from '../../src/item';

describe('Item', () => {
  let item;

  const name = 'String';

  describe('constructor', () => {
    beforeEach(() => {
      item = new Item(name, 0);
    });

    it('should construct properly', () => {
      expect(item.name).to.be.equal(name);
      expect(item.mainIndex).to.be.equal(0);
    });
  });

  describe('matching', () => {
    beforeEach(() => {
      item = new Item(name, 0);
    });

    it('should match and calculate the weight properly', () => {
      expect(item.calcMatch('s')).to.be.ok;
    });

    it('matches should be empty if there is no match', () => {
      expect(item.calcMatch('y')).not.to.be.ok;
    });
  });
});<commit_msg>Improves item tests<commit_after>import Item from '../../src/item';

describe('Item', () => {
  describe('constructor', () => {
    it('should construct properly', () => {
      const item = new Item('String', 0);

      expect(item.name).to.be.equal('String');
      expect(item.mainIndex).to.be.equal(0);
    });
  });

  describe('matching', () => {
    it('should match and calculate the weight properly', () => {
      const item = new Item('String', 0);

      expect(item.calcMatch('s')).to.be.ok;
    });

    it('matches should be empty if there is no match', () => {
      const item = new Item('String', 0);

      expect(item.calcMatch('y')).not.to.be.ok;
    });

    it('should match a string that have section starts after non section starts', () => {
      const item1 = new Item('ateSt', 0);
      const item2 = new Item('ateStT', 0);

      const calcMatch1 = item1.calcMatch('test');
      const calcMatch2 = item2.calcMatch('test');

      expect(calcMatch1).to.be.ok;
      expect(calcMatch2).to.be.ok;

      expect(calcMatch1).to.be.above(calcMatch2);
    });
  });
});
{'fraction_non_alphanumeric': 0.20387811634349032, 'fraction_numerical': 0.010526315789473684, 'mean_word_length': 2.778242677824268, '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': '761588', 'n_tokens_mistral': 595, 'n_tokens_neox': 573, 'n_words': 123}