<commit_before>// ---------------------------------------------------------------------------------------------------------------------
// Unit Tests for the jdb.spec.js module.
//
// @module jdb.spec.js
// ---------------------------------------------------------------------------------------------------------------------

var fs = require('fs');
var path = require('path');
var assert = require("assert");

var Promise = require('bluebird');

var JDB = require('../lib/jdb');

// ---------------------------------------------------------------------------------------------------------------------

describe('JDB Instance', function()
{
    var testDB = '{"cfvtjn3dzYLJzbbfKCcZsrTXDJw=": {"name":"<NAME>","role":"hero"},'
    + '"1lT/bTHNj2G3abAf+OsPNaV2Sgw=":{"name":"Dr. Horrible","role": "villian"}}';

    //FIXME: This will not work on windows. I can't be bothered to fix it right now.
    var rootPath = '/tmp';

    fs.writeFileSync(path.resolve(rootPath, 'jdb_test.json'), testDB);<commit_msg>Fix temp path generation for cross-platform use<commit_after>// ---------------------------------------------------------------------------------------------------------------------
// Unit Tests for the jdb.spec.js module.
//
// @module jdb.spec.js
// ---------------------------------------------------------------------------------------------------------------------

var fs = require('fs');
var path = require('path');
var assert = require("assert");
var os = require('os');

var Promise = require('bluebird');

var JDB = require('../lib/jdb');

// ---------------------------------------------------------------------------------------------------------------------

describe('JDB Instance', function()
{
    var testDB = '{"cfvtjn3dzYLJzbbfKCcZsrTXDJw=": {"name":"<NAME>","role":"hero"},'
    + '"1lT/bTHNj2G3abAf+OsPNaV2Sgw=":{"name":"Dr. Horrible","role": "villian"}}';

    var rootPath = os.tmpdir();

    fs.writeFileSync(path.resolve(rootPath, 'jdb_test.json'), testDB);
{'fraction_non_alphanumeric': 0.48843058350100604, 'fraction_numerical': 0.005030181086519115, 'mean_word_length': 1.0936842105263158, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 5, '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': '5786389', 'n_tokens_mistral': 504, 'n_tokens_neox': 486, 'n_words': 104}