1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 08:20:11 +00:00

Scrub tests.

This commit is contained in:
hacksalot 2016-02-11 12:08:11 -05:00
parent 317a250917
commit f83eb018e8
8 changed files with 60 additions and 9 deletions

View File

@ -7,6 +7,6 @@ require('./scripts/test-cli');
require('./scripts/test-fresh-sheet'); require('./scripts/test-fresh-sheet');
require('./scripts/test-jrs-sheet'); require('./scripts/test-jrs-sheet');
require('./scripts/test-themes'); require('./scripts/test-themes');
require('./scripts/test-api'); require('./scripts/test-verbs');
require('./scripts/test-output'); require('./scripts/test-output');
require('./scripts/test-dates'); require('./scripts/test-dates');

View File

@ -1,6 +1,8 @@
/** /**
CLI test routines for HackMyResume. CLI test routines for HackMyResume. Test the HackMyResume command-line interface
by spawning HMR directly and observing the return code and std output.
@module test-cli.js @module test-cli.js
@license MIT. See LICENSE.md for details.
*/ */
@ -13,12 +15,11 @@ var chai = require('chai')
, EXEC = require('child_process').exec , EXEC = require('child_process').exec
describe('Testing CLI interface', function () { describe('Testing CLI interface', function () {
this.timeout(5000); this.timeout(5000);
// Run a test through the stub, gathering console.log output into "gather"
// and testing against it.
function run( args, expErr ) { function run( args, expErr ) {
var title = args; var title = args;
it( 'Testing: "' + title + '"\n\n', function( done ) { it( 'Testing: "' + title + '"\n\n', function( done ) {
@ -36,7 +37,8 @@ describe('Testing CLI interface', function () {
}); });
} }
var lines = FS.readFileSync( PATH.join( __dirname, './test-hmr.txt'), 'utf8').split('\n'); var testFile = PATH.join( __dirname, './test-hmr.txt');
var lines = FS.readFileSync( testFile, 'utf8').split('\n');
lines.forEach(function(l){ lines.forEach(function(l){
if( l && l.trim() ) { if( l && l.trim() ) {
if(l[0] !== '#') { if(l[0] !== '#') {

View File

@ -1,7 +1,11 @@
/** /**
Test routines for HackMyResume dates, times, and datetimes.
@module test-dates.js @module test-dates.js
@license MIT. See LICENSE.md for details.
*/ */
var chai = require('chai') var chai = require('chai')
, expect = chai.expect , expect = chai.expect
, should = chai.should() , should = chai.should()
@ -12,8 +16,12 @@ var chai = require('chai')
, validator = require('is-my-json-valid') , validator = require('is-my-json-valid')
, EXTEND = require('extend'); , EXTEND = require('extend');
chai.config.includeStack = true; chai.config.includeStack = true;
var gig = { var gig = {
employer: 'E1' employer: 'E1'
}; };
@ -28,6 +36,8 @@ var r = {
} }
}; };
var tests = [ var tests = [
// single job, concrete start, no end // single job, concrete start, no end
[ { start: '2010-01-01' } , { val: 6, unit: 'year' } ], [ { start: '2010-01-01' } , { val: 6, unit: 'year' } ],
@ -58,10 +68,14 @@ var tests = [
]; ];
tests.forEach(function(t){ tests.forEach(function(t){
_.initial( t ).forEach(function(t){ t.employer = 'E1' }); _.initial( t ).forEach(function(t){ t.employer = 'E1' });
}) })
describe('Testing DATES', function () { describe('Testing DATES', function () {
tests.forEach( function(t) { tests.forEach( function(t) {

View File

@ -1,3 +1,10 @@
/**
Test routines for the FRESHResume class.
@module test-jrs-sheet.js
@license MIT. See LICENSE.md for details.
*/
var chai = require('chai') var chai = require('chai')
, expect = chai.expect , expect = chai.expect
@ -8,8 +15,12 @@ var chai = require('chai')
, ResumeFactory = require('../../dist/core/resume-factory') , ResumeFactory = require('../../dist/core/resume-factory')
, validator = require('is-my-json-valid'); , validator = require('is-my-json-valid');
chai.config.includeStack = false; chai.config.includeStack = false;
function testResume(opts) { function testResume(opts) {
describe( opts.title + ' (FRESH)', function () { describe( opts.title + ' (FRESH)', function () {

View File

@ -1,3 +1,10 @@
/**
Test routines for the JRSResume class.
@module test-jrs-sheet.js
@license MIT. See LICENSE.md for details.
*/
var chai = require('chai') var chai = require('chai')
, expect = chai.expect , expect = chai.expect
@ -8,8 +15,12 @@ var chai = require('chai')
, ResumeFactory = require('../../dist/core/resume-factory') , ResumeFactory = require('../../dist/core/resume-factory')
, validator = require('is-my-json-valid'); , validator = require('is-my-json-valid');
chai.config.includeStack = false; chai.config.includeStack = false;
function testResume( opts ) { function testResume( opts ) {
describe( opts.title + ' (JRS)', function() { describe( opts.title + ' (JRS)', function() {

View File

@ -1,6 +1,7 @@
/** /**
CLI test routines for HackMyResume. Output test routines for HackMyResume. Make sure our outputs are consistent.
@module test-cli.js @module test-output.js
@license MIT. See LICENSE.md for details.
*/ */

View File

@ -1,3 +1,11 @@
/**
Theme test routines for HackMyResume. Test all preinstalled HackMyResume themes
along with a handful of JSON Resume themes for good measure. Uses the HMR verb
interface.
@module test-themes.js
@license MIT. See LICENSE.md for details.
*/
var chai = require('chai') var chai = require('chai')
, expect = chai.expect , expect = chai.expect

View File

@ -1,5 +1,8 @@
/** /**
@module test-api.js High-level API test routines for HackMyResume. Test HackMyResume verbs such
as build, new, peek, etc., by creating and invoking a Verb object.
@module test-verbs.js
@license MIT. See LICENSE.md for details.
*/ */
var chai = require('chai') var chai = require('chai')
@ -172,7 +175,8 @@ describe('Testing API interface', function () {
shouldSucceed = false; shouldSucceed = false;
} }
it( 'The ' + verb.toUpperCase() + ' command should ' + (shouldSucceed ? ' NOT THROW' : ' THROW') + msg, function () { it( 'The ' + verb.toUpperCase() + ' command should ' +
(shouldSucceed ? ' NOT THROW' : ' THROW') + msg, function () {
function runIt() { function runIt() {
try { try {