<commit_before>var should = require("chai").should();
var Antfarm = require("./../../lib/antfarm");
var tmp = require('tmp');
var fs = require("fs");
var path = require('path');
//var mock = require('mock-fs');


describe('Tunnels', function() {

    var options = {
        log_dir: "/Users/dominickpeluso/Desktop",
        log_out_level: "error"
    };
    var af, tunnel, tmpobj, tempFileObj;

    before(function(){
        //
        // var fs_obj = {};
        //
        // fs_obj[_DIR_1_] = {
        //     'some-file.txt': 'file content here',
        //     'empty-dir': {/** empty directory */}
        // };
        // fs_obj[_DIR_2_] = {/** another empty directory */};
        //
        // mock(fs_obj);

    });

    beforeEach(function() {
        af = new Antfarm(options);
        tunnel = af.createTunnel("Test tunnel");
        tmpobj = tmp.dirSync();
        tempFileObj = tmp.fileSync();
    });

    afterEach(function() {
        tmpobj.removeCallback();
        tempFileObj.removeCallback();
    });

    after(function(){
       // mock.restore();
    });

    it('should get the tunnel name', function () {
        tunnel.getName().should.equal("Test tunnel");
    });

    it('should add a run callback to the run list', function () {
        tunnel.run(function(){});
        tunnel.getRunList().length.should.equal(1);
    });
<commit_msg>Use temporary log directory in tests<commit_after>var should = require("chai").should();
var Antfarm = require("./../../lib/antfarm");
var tmp = require('tmp');
var fs = require("fs");
var path = require('path');
//var mock = require('mock-fs');


describe('Tunnels', function() {

    var af, tunnel, tmpobj, tempFileObj;

    var options = {
        log_out_level: "error"
    };

    before("make temporary log directory", function(done){
        tmp.dir({ unsafeCleanup: true }, function(err, dir) {
            if (err) return done(err);
            setTimeout(function(){
                options.log_dir = dir;
                done()
            }, 600);
        });
    });

    beforeEach(function() {
        af = new Antfarm(options);
        tunnel = af.createTunnel("Test tunnel");
        tmpobj = tmp.dirSync();
        tempFileObj = tmp.fileSync();
    });

    afterEach(function() {
        tmpobj.removeCallback();
        tempFileObj.removeCallback();
    });

    after(function(){
       // mock.restore();
    });

    it('should get the tunnel name', function () {
        tunnel.getName().should.equal("Test tunnel");
    });

    it('should add a run callback to the run list', function () {
        tunnel.run(function(){});
        tunnel.getRunList().length.should.equal(1);
    });

{'fraction_non_alphanumeric': 0.174496644295302, 'fraction_numerical': 0.002609992542878449, 'mean_word_length': 2.20933014354067, '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': '6929783', 'n_tokens_mistral': 805, 'n_tokens_neox': 787, 'n_words': 172}