<commit_before>export default function createTapeTest({actions, imports, reducer, equalityFunction}) {
  return (`var test = require('tape');
${imports}
${reducer}
var equality = ${equalityFunction};

test('expected state returned for each action', function(assert) {
  var actions = ${JSON.stringify(actions, null, 2)};
  actions.forEach(function(action, index) {
    var result = reducer(action.prevState, action.action);
    assert.ok(equality(result, action.nextState), action.action.type + '(action index ' + index +') correctly updated state');
  });
  assert.end();
});`
  );
}<commit_msg>write multiple tests for tape generation instead of asserts in a forEach loop<commit_after>export default function createTapeTest({actions, imports, reducer, equalityFunction}) {
  const asserts = actions.map((action, index) => {
    return `test('${action.action.type} (action index ${index}) should correctly update state', function(assert) {
    var action = actions[${index}];
    var result = reducer(action.prevState, action.action);
    assert.ok(equality(result, action.nextState), 'state updated correctly');
    assert.end();
  });`}).join('\n\n');
  return (`var test = require('tape');
${imports}
${reducer}
var equality = ${equalityFunction};
var actions = ${JSON.stringify(actions, null, 2)};

${asserts}`
  );
}
{'fraction_non_alphanumeric': 0.15960665658093798, 'fraction_numerical': 0.0015128593040847202, 'mean_word_length': 5.517241379310345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5489481', 'n_tokens_mistral': 388, 'n_tokens_neox': 382, 'n_words': 106}