<commit_before>//  Mocha ChaiJS Tests for joeypc.com JavaScript library
//  http://danmckeown.info/code/ryukyu/ryukyu-docs/randomColorsPage.html
//  May 2016    v0.1.0

var domSimulator = require('jsdom-global')();   //  This requires jsdom
                                        //  npm install jsdom-global
                                        //  npm install jsdom
var fs = require('fs');
var vm = require('vm');

$ = require('../js/jquery.js');
//  var $ = require('../js/jquery.js');
// var jQpath = './js/jquery.js';
// var jQcode = fs.readFileSync(jQpath);
// vm.runInThisContext(jQcode);

//  joeypc_make_random_light_text = require('../js/joeypc.js');
var path = './js/joeypc.js';
var code = fs.readFileSync(path);
vm.runInThisContext(code);

var chai = require('chai');
var jq_plugin  = require("chai-jq");       //  This requires chai-jq
                                        //  npm install chai-jq
chai.use(jq_plugin);                    // Inject jq plugin.
//  var assert = require('chai').assert;    //  Chai needs to be installed:
                                        //  npm install chai
//  var expect = require('chai').expect;    //  Also the Mocha Testing Framework:
                                        //  npm install mocha
var expect = chai.expect;

describe('joeypc_make_random_light_text', function() {
    it('the function joeypc_make_random_light_text() is a function', function () {
      expect(joeypc_make_random_light_text).to.be.a('function');
    });
});

describe('joeypc_change_background', function() {
    it('the function joeypc_change_background yellow changes the body background color to yellow', function () {
      joeypc_change_background('yellow');
    //  expect('body').to.have.$attr('background-color', 'yellow');
      expect($("body")).to.be.$visible
    });
});<commit_msg>new joeypc.js tests: (working) background color check, and random digit < 10<commit_after>//  Mocha ChaiJS Tests for joeypc.com JavaScript library
//  http://danmckeown.info/code/ryukyu/ryukyu-docs/randomColorsPage.html
//  May 2016    v0.1.0

var chai = require('chai');
chai.use(require('chai-jq'));

var domSimulator = require('jsdom-global')();   //  This requires jsdom
                                        //  npm install jsdom-global
                                        //  npm install jsdom
$ = require('../js/jquery.js');

var fs = require('fs');
var vm = require('vm');

//  var $ = require('../js/jquery.js');
// var jQpath = './js/jquery.js';
// var jQcode = fs.readFileSync(jQpath);
// vm.runInThisContext(jQcode);

//  joeypc_make_random_light_text = require('../js/joeypc.js');
var path = './js/joeypc.js';
var code = fs.readFileSync(path);
vm.runInThisContext(code);

//	var jq_plugin  = require("chai-jq");       //  This requires chai-jq
                                        //  npm install chai-jq
//	chai.use(jq_plugin);                    // Inject jq plugin.
//  var assert = require('chai').assert;    //  Chai needs to be installed:
                                        //  npm install chai
//  var expect = require('chai').expect;    //  Also the Mocha Testing Framework:
                                        //  npm install mocha
var expect = chai.expect;
var assert = chai.assert;

describe('joeypc_make_random_light_text', function() {
    it('the function joeypc_make_random_light_text() is a function', function () {
      expect(joeypc_make_random_light_text).to.be.a('function');
    });
});

describe('joeypc_change_background', function() {
    it('the function joeypc_change_background yellow changes the body background color to yellow', function () {
		joeypc_change_background('yellow');
			var the_body = $('body');
			expect(the_body).to.be.$visible;
			expect(the_body).to.have.$css('background-color', 'yellow');
    });
});

describe('joeypc_random_digit', function() {
    it('the function joeypc_random_digit returns a number from 0 to 9', function () {
      var the_digit = joeypc_random_digit();
		console.log('digit returned: ' + the_digit);
		assert.isBelow(the_digit, 10, 'the digit is less than 10');
    });
});
{'fraction_non_alphanumeric': 0.14743745445712897, 'fraction_numerical': 0.005343696866650474, 'mean_word_length': 2.414593698175788, 'pattern_counts': {'":': 0, '<': 4, '<?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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5246715', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1251, 'n_words': 280}