<commit_before>
var assert = require('assert')
  , sleepyhollow = require('./')
  , drjekyll = sleepyhollow('node_modules/sleepyhollow-phantom/test.js')
  ;

// the events we've seen, need to see
var events = [], needed = ["open", "render", "exit", "ack" ];

// register event listeners
needed.forEach(function(need) {
    drjekyll.on(need, function() {
        events.push(need);
    });
});

// tell mrhyde to open github.com
setTimeout(function() { drjekyll.emit('page', "https://github.com/"); }, 1e3);
drjekyll.on('render', function() { drjekyll.emit("end"); });

// run tests when phantomjs finishes
drjekyll.on('exit', function() {
    var success = true;
    needed.forEach(function(need) {
        var found = false;
        events.forEach(function(event) {
            if (need == event) found = true;
        });
        assert(found, need + " event was not fired");
        if (!found) success = false;
    });
    process.exit(success ? 0 : 1);
});<commit_msg>adding new test for large buffer tests<commit_after>
var assert = require('assert')
  , sleepyhollow = require('./')
  , drjekyll = sleepyhollow('node_modules/sleepyhollow-phantom/test.js')
  ;

// the events we've seen, need to see
var events = [], needed = ["open", "render", "exit", "ack" ];

// register event listeners
needed.forEach(function(need) {
    drjekyll.on(need, function() {
        events.push(need);
    });
});

// generate a large string of alphabetical characters
var len = 1e4, mod = 26, pad = 65;
var challenge = [];
for (var i = 0; i < len; i++) {
    var c = (i % mod) + pad;
    challenge += String.fromCharCode(c);
}

// add a special case, to check for the large string
needed.push("output");
drjekyll.on("output", function(response) {
    assert.equal(challenge, response, "buffered communication failure");
});

// tell mrhyde to open github.com
setTimeout(function() { drjekyll.emit('page', "https://github.com/"); }, 1e3);
drjekyll.on('render', function() { drjekyll.emit("end"); });

// run tests when phantomjs finishes
drjekyll.on('exit', function() {
    var success = true;
    needed.forEach(function(need) {
        var found = false;
        events.forEach(function(event) {
            if (need == event) found = true;
        });
        assert(found, need + " event was not fired");
        if (!found) success = false;
    });

    process.exit(success ? 0 : 1);
});
{'fraction_non_alphanumeric': 0.17037347880822493, 'fraction_numerical': 0.00629458665547629, 'mean_word_length': 3.249554367201426, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2505583', 'n_tokens_mistral': 777, 'n_tokens_neox': 740, 'n_words': 202}