<commit_before>var utils = require('./test-utils');

var assert = require('chai').assert;
var fs = require('fs');
var path = require('path');
var crypto = require('crypto');

var FileStorage = require('../lib/database/storage').FileStorage;

function sha1hash(string) {
  var shasum = crypto.createHash('sha1');
  shasum.update(string);
  return shasum.digest('hex');
}

function createNewDocument() {
  return {
    id: Date.now(),
    date: (new Date()).toString()
  };
}

function assertFilesCount(directoryPath, delta, task) {
  var files = fs.readdirSync(directoryPath);
  var beforeCount = files.length;
  task();<commit_msg>Stringify the id to be converted to a sha1 hash<commit_after>var utils = require('./test-utils');

var assert = require('chai').assert;
var fs = require('fs');
var path = require('path');
var crypto = require('crypto');

var FileStorage = require('../lib/database/storage').FileStorage;

function sha1hash(string) {
  var shasum = crypto.createHash('sha1');
  shasum.update(String(string));
  return shasum.digest('hex');
}

function createNewDocument() {
  return {
    id: Date.now(),
    date: (new Date()).toString()
  };
}

function assertFilesCount(directoryPath, delta, task) {
  var files = fs.readdirSync(directoryPath);
  var beforeCount = files.length;
  task();
{'fraction_non_alphanumeric': 0.16411042944785276, 'fraction_numerical': 0.003834355828220859, 'mean_word_length': 4.878378378378378, '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': '629553', 'n_tokens_mistral': 410, 'n_tokens_neox': 409, 'n_words': 98}