<commit_before>var util = require('util');
should = require('should'),
fs = require('fs'),
path = require('path');
JSUS = require('./../jsus').JSUS;


var fsTestDir = null,
randomNum = null,
randomSubDir = null,
copyDir = null;

describe('FS: ', function(){

    after(function(){
	if (copyDir) {
	    JSUS.cleanDir(copyDir);
	}
	if (fsTestDir) {
	    JSUS.rmdirSyncRecursive(fsTestDir);
	}
    });


    describe('#deleteIfExists()', function(){

	before(function(){
	    fsTestDir = __dirname + '/tmp_jsus_fs_test/';
	    if (!JSUS.existsSync(fsTestDir)) {
		fs.mkdirSync(fsTestDir, 0755);
	    }

	    randomNum = JSUS.randomInt(0, 1000000);
	    randomSubDir = fsTestDir + randomNum + "/";

	    fs.mkdirSync(randomSubDir, 0755);

	    fs.writeFileSync(randomSubDir + "file", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file1.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file2.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file3.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file.txt", "Hey there!");
	});

	it('should return TRUE when deleting existing files.', function() {
	    var result = JSUS.deleteIfExists(randomSubDir + "file3.js");
	    result.should.be.true;
	});

	it('should unlink existing file from file system.', function() {
	    JSUS.existsSync(randomSubDir + "file3.js").should.be.false;
	});

	it('should return FALSE when deleting not existing files.', function() {
	    var result = JSUS.deleteIfExists(randomSubDir + "file100.js");
	    result.should.be.false;
	});

<commit_msg>Made deletion test use async correctly<commit_after>var util = require('util');
should = require('should'),
fs = require('fs'),
path = require('path');
JSUS = require('./../jsus').JSUS;


var fsTestDir = null,
randomNum = null,
randomSubDir = null,
copyDir = null;

describe('FS: ', function(){

    after(function(){
	if (copyDir) {
	    JSUS.cleanDir(copyDir);
	}
	if (fsTestDir) {
	    JSUS.rmdirSyncRecursive(fsTestDir);
	}
    });


    describe('#deleteIfExists()', function(){

	before(function(){
	    fsTestDir = __dirname + '/tmp_jsus_fs_test/';
	    if (!JSUS.existsSync(fsTestDir)) {
		fs.mkdirSync(fsTestDir, 0755);
	    }

	    randomNum = JSUS.randomInt(0, 1000000);
	    randomSubDir = fsTestDir + randomNum + "/";

	    fs.mkdirSync(randomSubDir, 0755);

	    fs.writeFileSync(randomSubDir + "file", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file1.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file2.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file3.js", "Hey there!");
	    fs.writeFileSync(randomSubDir + "file.txt", "Hey there!");
	});

	it('should return TRUE when deleting existing files.', function(done) {
	    var result = JSUS.deleteIfExists(randomSubDir + "file3.js", done);
	    result.should.be.true;
	});

	it('should unlink existing file from file system.', function() {
	    JSUS.existsSync(randomSubDir + "file3.js").should.be.false;
	});

	it('should return FALSE when deleting not existing files.', function() {
	    var result = JSUS.deleteIfExists(randomSubDir + "file100.js");
	    result.should.be.false;
	});


{'fraction_non_alphanumeric': 0.16725071678878622, 'fraction_numerical': 0.015291494106403312, 'mean_word_length': 3.8985959438377535, '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': '5126410', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1034, 'n_words': 214}