<commit_before>import { joinIf } from './index';
import { falsyList } from './falsy-list';

describe('Join if', () => {
  it('array has two items return second item if first item is true', () => {
    joinIf([true, 'beetroot']).should.equal('beetroot');
  });

  it('if array is less that two items return null', () => {
    (joinIf(['chicken']) === null).should.true();
  });

  it('if array has three items and first param is falsy it should return chicken', () => {
    joinIf([false, 'cow', 'chicken']).should.equal('chicken');
  });

  it('if array is greater that three items return null', () => {
    (joinIf([true, 'cow', 'chicken', 'lamb']) === null).should.true();
  });

  it('if not an array return param', () => {
    joinIf('potato').should.equal('potato');
  });

  falsyList.forEach((falsy) => {
    it(`first param is a falsy(${falsy}) then return null`, () => {
      (joinIf([falsy, 'chicken']) === null).should.true();
    });
  });
});<commit_msg>add more falsy tests for joinif<commit_after>import { joinIf } from './index';
import { falsyList } from './falsy-list';

describe('Join if', () => {
  it('array has two items return second item if first item is true', () => {
    joinIf([true, 'beetroot']).should.equal('beetroot');
  });

  it('if array is less that two items return null', () => {
    (joinIf(['chicken']) === null).should.true();
  });

  it('if array has three items and first param is truthy it should return cow', () => {
    joinIf([true, 'cow', 'chicken']).should.equal('cow');
  });

  it('if array is greater that three items return null', () => {
    (joinIf([true, 'cow', 'chicken', 'lamb']) === null).should.true();
  });

  it('if not an array return param', () => {
    joinIf('potato').should.equal('potato');
  });

  falsyList.forEach((falsy) => {
    it(`first param is a falsy(${falsy}) then return null`, () => {
      (joinIf([falsy, 'chicken']) === null).should.true();
    });

    it('if array has three items and first param is falsy(${falsy}) it should return chicken', () => {
    joinIf([falsy, 'cow', 'chicken']).should.equal('chicken');
  });
  });
});
{'fraction_non_alphanumeric': 0.21897121283624352, 'fraction_numerical': 0.0, 'mean_word_length': 3.732142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '2087716', 'n_tokens_mistral': 704, 'n_tokens_neox': 699, 'n_words': 192}