mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
e2589b3730
Still hitting some inconsistent behavior in different NPM versions/platforms with invalid uppercase dependency names per https://github.com/npm/npm/issues/3692. Partial fix for #33.
68 lines
2.4 KiB
JavaScript
68 lines
2.4 KiB
JavaScript
|
|
var chai = require('chai')
|
|
, expect = chai.expect
|
|
, should = chai.should()
|
|
, path = require('path')
|
|
, _ = require('underscore')
|
|
, FRESHResume = require('../src/core/fresh-resume')
|
|
, validator = require('is-my-json-valid');
|
|
|
|
chai.config.includeStack = false;
|
|
|
|
describe('jane-doe.json (FRESH)', function () {
|
|
|
|
var _sheet;
|
|
|
|
it('should open without throwing an exception', function () {
|
|
function tryOpen() {
|
|
_sheet = new FRESHResume().open(
|
|
'node_modules/jane-q-fullstacker/resume/jane-resume.json' );
|
|
}
|
|
tryOpen.should.not.Throw();
|
|
});
|
|
|
|
it('should have one or more of each section', function() {
|
|
expect(
|
|
//(_sheet.basics) &&
|
|
_sheet.name && _sheet.info && _sheet.location && _sheet.contact &&
|
|
(_sheet.employment.history && _sheet.employment.history.length > 0) &&
|
|
(_sheet.skills && _sheet.skills.list.length > 0) &&
|
|
(_sheet.education.history && _sheet.education.history.length > 0) &&
|
|
(_sheet.service.history && _sheet.service.history.length > 0) &&
|
|
(_sheet.writing && _sheet.writing.length > 0) &&
|
|
(_sheet.recognition && _sheet.recognition.length > 0) &&
|
|
(_sheet.samples && _sheet.samples.length > 0) &&
|
|
(_sheet.references && _sheet.references.length > 0) &&
|
|
(_sheet.interests && _sheet.interests.length > 0)
|
|
).to.equal( true );
|
|
});
|
|
|
|
it('should have a work duration of 7 years', function() {
|
|
_sheet.computed.numYears.should.equal( 7 );
|
|
});
|
|
|
|
it('should save without throwing an exception', function(){
|
|
function trySave() {
|
|
_sheet.save( 'tests/sandbox/jane-q-fullstacker.json' );
|
|
}
|
|
trySave.should.not.Throw();
|
|
});
|
|
|
|
it('should not be modified after saving', function() {
|
|
var savedSheet = new FRESHResume().open('tests/sandbox/jane-q-fullstacker.json');
|
|
_sheet.stringify().should.equal( savedSheet.stringify() )
|
|
});
|
|
|
|
it('should validate against the FRESH resume schema', function() {
|
|
var result = _sheet.isValid();
|
|
// var schemaJson = require('fresca');
|
|
// var validate = validator( schemaJson, { verbose: true } );
|
|
// var result = validate( JSON.parse( _sheet.imp.raw ) );
|
|
result || console.log("\n\nOops, resume didn't validate. " +
|
|
"Validation errors:\n\n", _sheet.imp.validationErrors, "\n\n");
|
|
result.should.equal( true );
|
|
});
|
|
|
|
|
|
});
|