From f83eb018e8b7526c030a899a13515f6a248b5ac9 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 11 Feb 2016 12:08:11 -0500 Subject: [PATCH] Scrub tests. --- test/all.js | 2 +- test/scripts/test-cli.js | 10 ++++++---- test/scripts/test-dates.js | 14 ++++++++++++++ test/scripts/test-fresh-sheet.js | 11 +++++++++++ test/scripts/test-jrs-sheet.js | 11 +++++++++++ test/scripts/test-output.js | 5 +++-- test/scripts/test-themes.js | 8 ++++++++ test/scripts/{test-api.js => test-verbs.js} | 8 ++++++-- 8 files changed, 60 insertions(+), 9 deletions(-) rename test/scripts/{test-api.js => test-verbs.js} (92%) diff --git a/test/all.js b/test/all.js index 9a90464..010d661 100644 --- a/test/all.js +++ b/test/all.js @@ -7,6 +7,6 @@ require('./scripts/test-cli'); require('./scripts/test-fresh-sheet'); require('./scripts/test-jrs-sheet'); require('./scripts/test-themes'); -require('./scripts/test-api'); +require('./scripts/test-verbs'); require('./scripts/test-output'); require('./scripts/test-dates'); diff --git a/test/scripts/test-cli.js b/test/scripts/test-cli.js index 1ccdf4f..38e111e 100644 --- a/test/scripts/test-cli.js +++ b/test/scripts/test-cli.js @@ -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 +@license MIT. See LICENSE.md for details. */ @@ -13,12 +15,11 @@ var chai = require('chai') , EXEC = require('child_process').exec + describe('Testing CLI interface', function () { this.timeout(5000); - // Run a test through the stub, gathering console.log output into "gather" - // and testing against it. function run( args, expErr ) { var title = args; 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){ if( l && l.trim() ) { if(l[0] !== '#') { diff --git a/test/scripts/test-dates.js b/test/scripts/test-dates.js index 93f58ec..4ebd389 100644 --- a/test/scripts/test-dates.js +++ b/test/scripts/test-dates.js @@ -1,7 +1,11 @@ /** +Test routines for HackMyResume dates, times, and datetimes. @module test-dates.js +@license MIT. See LICENSE.md for details. */ + + var chai = require('chai') , expect = chai.expect , should = chai.should() @@ -12,8 +16,12 @@ var chai = require('chai') , validator = require('is-my-json-valid') , EXTEND = require('extend'); + + chai.config.includeStack = true; + + var gig = { employer: 'E1' }; @@ -28,6 +36,8 @@ var r = { } }; + + var tests = [ // single job, concrete start, no end [ { start: '2010-01-01' } , { val: 6, unit: 'year' } ], @@ -58,10 +68,14 @@ var tests = [ ]; + + tests.forEach(function(t){ _.initial( t ).forEach(function(t){ t.employer = 'E1' }); }) + + describe('Testing DATES', function () { tests.forEach( function(t) { diff --git a/test/scripts/test-fresh-sheet.js b/test/scripts/test-fresh-sheet.js index b2d206e..67c8123 100644 --- a/test/scripts/test-fresh-sheet.js +++ b/test/scripts/test-fresh-sheet.js @@ -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') , expect = chai.expect @@ -8,8 +15,12 @@ var chai = require('chai') , ResumeFactory = require('../../dist/core/resume-factory') , validator = require('is-my-json-valid'); + + chai.config.includeStack = false; + + function testResume(opts) { describe( opts.title + ' (FRESH)', function () { diff --git a/test/scripts/test-jrs-sheet.js b/test/scripts/test-jrs-sheet.js index 76ad314..1b49f11 100644 --- a/test/scripts/test-jrs-sheet.js +++ b/test/scripts/test-jrs-sheet.js @@ -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') , expect = chai.expect @@ -8,8 +15,12 @@ var chai = require('chai') , ResumeFactory = require('../../dist/core/resume-factory') , validator = require('is-my-json-valid'); + + chai.config.includeStack = false; + + function testResume( opts ) { describe( opts.title + ' (JRS)', function() { diff --git a/test/scripts/test-output.js b/test/scripts/test-output.js index afb4b44..e270184 100644 --- a/test/scripts/test-output.js +++ b/test/scripts/test-output.js @@ -1,6 +1,7 @@ /** -CLI test routines for HackMyResume. -@module test-cli.js +Output test routines for HackMyResume. Make sure our outputs are consistent. +@module test-output.js +@license MIT. See LICENSE.md for details. */ diff --git a/test/scripts/test-themes.js b/test/scripts/test-themes.js index 50b04dc..76b9eab 100644 --- a/test/scripts/test-themes.js +++ b/test/scripts/test-themes.js @@ -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') , expect = chai.expect diff --git a/test/scripts/test-api.js b/test/scripts/test-verbs.js similarity index 92% rename from test/scripts/test-api.js rename to test/scripts/test-verbs.js index cf7bb03..b35a9fb 100644 --- a/test/scripts/test-api.js +++ b/test/scripts/test-verbs.js @@ -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') @@ -172,7 +175,8 @@ describe('Testing API interface', function () { 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() { try {