1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-26 10:10:12 +00:00
HackMyResume/tests/test-fresh-sheet.js

74 lines
2.5 KiB
JavaScript
Raw Permalink Normal View History

2015-11-19 04:44:16 +00:00
var chai = require('chai')
, expect = chai.expect
, should = chai.should()
, path = require('path')
, _ = require('underscore')
, FRESHResume = require('../src/core/fresh-resume')
2015-11-19 04:44:16 +00:00
, validator = require('is-my-json-valid');
chai.config.includeStack = false;
describe('jane-doe.json (FRESH)', function () {
2015-11-19 04:44:16 +00:00
var _sheet;
it('should open without throwing an exception', function () {
function tryOpen() {
2015-11-19 20:39:26 +00:00
_sheet = new FRESHResume().open(
'node_modules/FRESCA/exemplar/jane-doe.json' );
2015-11-19 04:44:16 +00:00
}
tryOpen.should.not.Throw();
});
it('should have one or more of each section', function() {
expect(
//(_sheet.basics) &&
2015-11-19 20:39:26 +00:00
_sheet.name && _sheet.info && _sheet.location && _sheet.contact &&
2015-11-19 04:44:16 +00:00
(_sheet.employment.history && _sheet.employment.history.length > 0) &&
2015-11-20 13:29:28 +00:00
(_sheet.skills && _sheet.skills.list.length > 0) &&
2015-11-19 04:44:16 +00:00
(_sheet.education.history && _sheet.education.history.length > 0) &&
(_sheet.service.history && _sheet.service.history.length > 0) &&
2015-11-20 13:29:28 +00:00
(_sheet.writing && _sheet.writing.length > 0) &&
2015-11-19 20:39:26 +00:00
(_sheet.recognition && _sheet.recognition.length > 0) &&
(_sheet.samples && _sheet.samples.length > 0) &&
(_sheet.references && _sheet.references.length > 0) &&
(_sheet.interests && _sheet.interests.length > 0)
2015-11-19 04:44:16 +00:00
).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() {
2015-11-20 13:29:28 +00:00
_sheet.save( 'tests/sandbox/jane-doe.json' );
2015-11-19 04:44:16 +00:00
}
trySave.should.not.Throw();
});
it('should not be modified after saving', function() {
2015-11-20 13:29:28 +00:00
var savedSheet = new FRESHResume().open('tests/sandbox/jane-doe.json');
2015-11-19 04:44:16 +00:00
_sheet.stringify().should.equal( savedSheet.stringify() )
});
2015-11-19 21:24:56 +00:00
it('should validate against the FRESH resume schema', function() {
var result = _sheet.isValid();
// var schemaJson = require('FRESCA');
// var validate = validator( schemaJson, { verbose: true } );
2015-11-20 14:28:55 +00:00
// var result = validate( JSON.parse( _sheet.imp.raw ) );
2015-11-19 21:24:56 +00:00
result || console.log("\n\nOops, resume didn't validate. " +
2015-11-20 14:28:55 +00:00
"Validation errors:\n\n", _sheet.imp.validationErrors, "\n\n");
2015-11-19 21:24:56 +00:00
result.should.equal( true );
});
2015-11-19 04:44:16 +00:00
});
// describe('subtract', function () {
// it('should return -1 when passed the params (1, 2)', function () {
// expect(math.subtract(1, 2)).to.equal(-1);
// });
// });