<commit_before>const { expect } = require('chai');

const empty = require('../../src/empty');


describe('empty', () => {
  it('Shuld empty flat array', () => {
    const flatArray = [1, 5, 3, 2, 4, 5];
    empty(flatArray);
    expect(flatArray.length).to.equal(0);
  });

  it('Should empty deep object array', () => {
    const persons = [
      { id: 1, name: 'first' },
      {
        id: 2,
        name: 'middle',
        address: {
          city: 'Split'
        }
      },
      { id: 3, name: 'middle' },
      { id: 4, name: 'last' }
    ];

    // response should be equal to the provided emptied array
    const response = empty(persons);
    expect(persons.length).to.equal(0);
    expect(response).to.eql(persons);
  });

  it('Should not break if array is not provided', () => {
    const response = empty(33);
    expect(response).to.eql(33);
  });
});<commit_msg>Add spec for emptyng empty array<commit_after>const { expect } = require('chai');

const empty = require('../../src/empty');


describe('empty', () => {
  it('Shuld empty flat array', () => {
    const flatArray = [1, 5, 3, 2, 4, 5];
    empty(flatArray);
    expect(flatArray.length).to.equal(0);
  });

  it('Should empty deep object array', () => {
    const persons = [
      { id: 1, name: 'first' },
      {
        id: 2,
        name: 'middle',
        address: {
          city: 'Split'
        }
      },
      { id: 3, name: 'middle' },
      { id: 4, name: 'last' }
    ];

    // response should be equal to the provided emptied array
    const response = empty(persons);
    expect(persons.length).to.equal(0);
    expect(response).to.eql(persons);
  });

  it('emptying already empty array should be ignored', () => {
    const emptyArr = [];
    const response = empty(emptyArr);
    expect(emptyArr).to.equal(response);
  });

  it('Should not break if array is not provided', () => {
    const response = empty(33);
    expect(response).to.eql(33);
  });
});
{'fraction_non_alphanumeric': 0.183256763654926, 'fraction_numerical': 0.01633486472690148, 'mean_word_length': 2.444639718804921, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2452049', 'n_tokens_mistral': 667, 'n_tokens_neox': 633, 'n_words': 164}