1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-02 12:27:08 +01:00

Cleanup and bug fixes.

Remove file-based open methods from resume classes; force clients to use
clean string-based or JSON overloads; fix processing glitch in
validate(); tweak outputs; adjust tests; update CHANGELOG; etc.
This commit is contained in:
hacksalot
2016-02-04 18:49:16 -05:00
parent 661fb91861
commit 2758038858
14 changed files with 90 additions and 62 deletions

View File

@ -5,6 +5,7 @@ var chai = require('chai')
, path = require('path')
, _ = require('underscore')
, FRESHResume = require('../../dist/core/fresh-resume')
, ResumeFactory = require('../../dist/core/resume-factory')
, validator = require('is-my-json-valid');
chai.config.includeStack = false;
@ -17,7 +18,9 @@ function testResume(opts) {
it('should open without throwing an exception', function () {
function tryOpen() {
_sheet = new FRESHResume().open( opts.path );
var res = ResumeFactory.loadOne( opts.path, { objectify: true } );
_sheet = res.rez;
//_sheet = new FRESHResume().open( opts.path );
}
tryOpen.should.not.Throw();
});
@ -39,8 +42,9 @@ function testResume(opts) {
});
it('should not be modified after saving', function() {
var savedSheet = new FRESHResume().open('test/sandbox/' + opts.title + '.json');
_sheet.stringify().should.equal( savedSheet.stringify() );
var savedSheet = ResumeFactory.loadOne( 'test/sandbox/' + opts.title + '.json', { objectify: true } );
//var savedSheet = new FRESHResume().open('test/sandbox/' + opts.title + '.json');
_sheet.stringify().should.equal( savedSheet.rez.stringify() );
});
it('should validate against the FRESH resume schema', function() {

View File

@ -5,6 +5,7 @@ var chai = require('chai')
, path = require('path')
, _ = require('underscore')
, JRSResume = require('../../dist/core/jrs-resume')
, ResumeFactory = require('../../dist/core/resume-factory')
, validator = require('is-my-json-valid');
chai.config.includeStack = false;
@ -20,8 +21,8 @@ function testResume( opts ) {
it('should open without throwing an exception', function () {
var that = this;
function tryOpen() {
_sheet = new JRSResume().open(
path.normalize( path.join( __dirname, '/../resumes/jrs-0.0.0/' + opts.title + '.json' ) ) )
var res = ResumeFactory.loadOne( path.normalize( path.join( __dirname, '/../resumes/jrs-0.0.0/' + opts.title + '.json' ) ), { objectify: true } );
_sheet = res.rez;
}
tryOpen.should.not.Throw();
});
@ -44,8 +45,8 @@ function testResume( opts ) {
});
it('should not be modified after saving', function() {
var savedSheet = new JRSResume().open( 'test/sandbox/' + opts.title + '.json' );
_sheet.stringify().should.equal( savedSheet.stringify() );
var res = ResumeFactory.loadOne( 'test/sandbox/' + opts.title + '.json', { objectify: true } );
_sheet.stringify().should.equal( res.rez.stringify() );
});
it('should ' + (opts.isValid ? '' : 'NOT ') + 'validate against the JSON Resume schema', function() {