<commit_before>var path = require('path');
var Stream = require('stream');
var expect = require('expect.js');
var hoodiejs = require('../../lib/helpers/pack_hoodie');
var _ = require('lodash');

describe('pack_hoodie', function () {

  // Dummy config object with plugins attribute.
  var config = { app: {}, plugins: [] };

  it('should be a function', function () {
    expect(hoodiejs).to.be.a(Function);
  });

  it('should return a readable stream on empty cache', function (done) {
    var stream = hoodiejs(config);

    expect(stream).to.be.a(Stream);
    expect(stream.readable).to.be(true);

    var chunks = [];
    stream.on('data', function (buf) {
      chunks.push(buf);
    });
    stream.on('end', function () {
      var js = chunks.join('');
      expect(/hoodie_bundle\.js/.test(js)).to.be(true);
      done();
    });
  });

  it('should return a cached string after first request', function () {
    var str = hoodiejs(config);
    expect(str).to.be.a('string');
    expect(/hoodie_bundle\.js/.test(str)).to.be(true);
  });

});<commit_msg>tests(fix): set higher timeout value for hoodie.js file creation<commit_after>var Stream = require('stream');
var expect = require('expect.js');
var hoodiejs = require('../../lib/helpers/pack_hoodie');

describe('pack_hoodie', function () {

  // Dummy config object with plugins attribute.
  var config = { app: {}, plugins: [] };

  it('should be a function', function () {
    expect(hoodiejs).to.be.a(Function);
  });

  it('should return a readable stream on empty cache', function (done) {

    this.timeout(5000);

    var stream = hoodiejs(config);

    expect(stream).to.be.a(Stream);
    expect(stream.readable).to.be(true);

    var chunks = [];
    stream.on('data', function (buf) {
      chunks.push(buf);
    });
    stream.on('end', function () {
      var js = chunks.join('');
      expect(/hoodie_bundle\.js/.test(js)).to.be(true);
      done();
    });
  });

  it('should return a cached string after first request', function () {
    var str = hoodiejs(config);
    expect(str).to.be.a('string');
    expect(/hoodie_bundle\.js/.test(str)).to.be(true);
  });

});
{'fraction_non_alphanumeric': 0.19012115563839702, 'fraction_numerical': 0.001863932898415657, 'mean_word_length': 3.3112449799196786, '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': '2256080', 'n_tokens_mistral': 702, 'n_tokens_neox': 677, 'n_words': 152}