<commit_before>/* global describe it beforeEach */
/* eslint no-new-wrappers: 0 */

'use strict';

var assert = require('assert');
var keys = require('keys');
var sinon = require('sinon');
var each = require('../');

// TODO: Tighten up these tests, remove duplicates
describe('each', function() {
  var identity;

  beforeEach(function() {
    identity = sinon.spy(function(val) {
      return val;
    });
  });

  it('should be a function', function() {
    assert.equal(typeof each, 'function');
  });

  it('should have an arity of 2', function() {
    assert(each.length, 2);
  });

  it('should pass `iterator` the value, index, and collection', function() {
    var elems = ['zero', 'one', 'two'];
    each(identity, elems);

    assert(identity.calledWithExactly('zero', 0, elems));
    assert(identity.calledWithExactly('one', 1, elems));
    assert(identity.calledWithExactly('two', 2, elems));
  });

  it('should iterate in left-to-right order', function() {
    var elems = [1, 0, 7, 14];
    each(identity, elems);

    assert(identity.firstCall.calledWithExactly(1, 0, elems));
    assert(identity.secondCall.calledWithExactly(0, 1, elems));
    assert(identity.thirdCall.calledWithExactly(7, 2, elems));<commit_msg>Fix broken assert<commit_after>/* global describe it beforeEach */
/* eslint no-new-wrappers: 0 */

'use strict';

var assert = require('assert');
var keys = require('keys');
var sinon = require('sinon');
var each = require('../');

// TODO: Tighten up these tests, remove duplicates
describe('each', function() {
  var identity;

  beforeEach(function() {
    identity = sinon.spy(function(val) {
      return val;
    });
  });

  it('should be a function', function() {
    assert.equal(typeof each, 'function');
  });

  it('should have an arity of 2', function() {
    assert.equal(each.length, 2);
  });

  it('should pass `iterator` the value, index, and collection', function() {
    var elems = ['zero', 'one', 'two'];
    each(identity, elems);

    assert(identity.calledWithExactly('zero', 0, elems));
    assert(identity.calledWithExactly('one', 1, elems));
    assert(identity.calledWithExactly('two', 2, elems));
  });

  it('should iterate in left-to-right order', function() {
    var elems = [1, 0, 7, 14];
    each(identity, elems);

    assert(identity.firstCall.calledWithExactly(1, 0, elems));
    assert(identity.secondCall.calledWithExactly(0, 1, elems));
    assert(identity.thirdCall.calledWithExactly(7, 2, elems));
{'fraction_non_alphanumeric': 0.17178658043654002, 'fraction_numerical': 0.0137429264349232, 'mean_word_length': 4.07172131147541, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2793866', 'n_tokens_mistral': 833, 'n_tokens_neox': 774, 'n_words': 207}