mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-12-23 05:37:23 +00:00
Improve test coverage around incomplete JRS resumes.
Add quick sanity checks around incomplete or irregular JRS-format resumes. Also decorate existing JRS test resumes (/tests/resumes/) with current 0.0.0 JRS version ahead of 1.0.0 release.
This commit is contained in:
parent
c5ee1ee33c
commit
bbac1fdceb
91
tests/resumes/jrs-0.0.0/empty.json
Normal file
91
tests/resumes/jrs-0.0.0/empty.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"basics": {
|
||||
"name": "",
|
||||
"label": "",
|
||||
"picture": "",
|
||||
"email": "",
|
||||
"phone": "",
|
||||
"degree": "",
|
||||
"website": "",
|
||||
"summary": "",
|
||||
"location": {
|
||||
"address": "",
|
||||
"postalCode": "",
|
||||
"city": "",
|
||||
"countryCode": "",
|
||||
"region": ""
|
||||
},
|
||||
"profiles": [
|
||||
{
|
||||
"network": "",
|
||||
"username": "",
|
||||
"url": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"work": [
|
||||
{
|
||||
"company": "",
|
||||
"position": "",
|
||||
"website": "",
|
||||
"startDate": "",
|
||||
"endDate": "",
|
||||
"summary": "",
|
||||
"highlights": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"awards": [
|
||||
{
|
||||
"title": "",
|
||||
"date": "",
|
||||
"awarder": "",
|
||||
"summary": ""
|
||||
}
|
||||
],
|
||||
"education": [
|
||||
{
|
||||
"institution": "",
|
||||
"area": "",
|
||||
"studyType": "",
|
||||
"startDate": "",
|
||||
"endDate": "",
|
||||
"gpa": "",
|
||||
"courses": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"publications": [
|
||||
{
|
||||
"name": "",
|
||||
"publisher": "",
|
||||
"releaseDate": "",
|
||||
"website": "",
|
||||
"summary": ""
|
||||
}
|
||||
],
|
||||
"volunteer": [
|
||||
{
|
||||
"organization": "",
|
||||
"position": "",
|
||||
"website": "",
|
||||
"startDate": "",
|
||||
"endDate": "",
|
||||
"summary": "",
|
||||
"highlights": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"skills": [
|
||||
{
|
||||
"name": "",
|
||||
"level": "",
|
||||
"keywords": [
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
104
tests/resumes/jrs-0.0.0/jane-incomplete.json
Normal file
104
tests/resumes/jrs-0.0.0/jane-incomplete.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"basics": {
|
||||
"name": "Jane Q. Fullstacker"
|
||||
},
|
||||
"education": [
|
||||
{
|
||||
"gpa": "3.5",
|
||||
"courses": [
|
||||
"Course 1",
|
||||
"Course 2",
|
||||
"Course 2"
|
||||
],
|
||||
"startDate": "2005-09",
|
||||
"endDate": "2008-05"
|
||||
},
|
||||
{
|
||||
"institution": "Medfield College",
|
||||
"gpa": "3.2",
|
||||
"courses": [
|
||||
"Course 1",
|
||||
"Course 2",
|
||||
"Course 2"
|
||||
],
|
||||
"startDate": "2003-09",
|
||||
"endDate": "2005-06"
|
||||
}
|
||||
],
|
||||
"skills": [
|
||||
{
|
||||
"name": "Web Dev",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
"HTML 5",
|
||||
"CSS",
|
||||
"LAMP",
|
||||
"MVC",
|
||||
"REST"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JavaScript"
|
||||
}
|
||||
],
|
||||
"volunteer": [],
|
||||
"publications": [
|
||||
{
|
||||
"name": "Building User Interfaces with Electron and Atom",
|
||||
"releaseDate": "2011",
|
||||
"website": "http://codeproject.com/build-ui-electron-atom.aspx"
|
||||
},
|
||||
{
|
||||
"name": "Jane Fullstacker's Blog",
|
||||
"publisher": "self",
|
||||
"releaseDate": "2011",
|
||||
"website": "http://janef.me"
|
||||
},
|
||||
{
|
||||
"name": "Teach Yourself GORFF in 21 Days",
|
||||
"publisher": "Amazon"
|
||||
}
|
||||
],
|
||||
"interests": [
|
||||
{
|
||||
"name": "reading",
|
||||
"summary": "Jane is a fan of mystery novels and courtroom dramas including Agatha Christie and John Grisham.",
|
||||
"keywords": [
|
||||
"mystery",
|
||||
"Agatha Christie",
|
||||
"John Grisham"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hiking",
|
||||
"summary": "Jane enjoys hiking, light mountain climbing, and has four summits under her belt!"
|
||||
},
|
||||
{
|
||||
"name": "yoga"
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"name": "John Davidson",
|
||||
"reference": "Jane is awesome! I'd hire her again in a heartbeat."
|
||||
},
|
||||
{
|
||||
"name": "Elias Fullstacker",
|
||||
"reference": "I worked with Jane on Jabberwocky and can vouch for her awesome technical capabilities and attention to detail. Insta-hire."
|
||||
},
|
||||
{
|
||||
"name": "Dana Nevins",
|
||||
"reference": "I've known Jane personally and professionally for almost ten years. She is one in a million."
|
||||
}
|
||||
],
|
||||
"languages": [
|
||||
{
|
||||
"language": "English",
|
||||
"level": "Native"
|
||||
},
|
||||
{
|
||||
"language": "Spanish",
|
||||
"level": "Moderate"
|
||||
}
|
||||
]
|
||||
}
|
@ -18,7 +18,7 @@ describe('FRESH/JRS converter', function () {
|
||||
|
||||
it('should round-trip from JRS to FRESH to JRS without modifying or losing data', function () {
|
||||
|
||||
var fileA = path.join( __dirname, 'resumes/jrs/richard-hendriks.json' );
|
||||
var fileA = path.join( __dirname, 'resumes/jrs-0.0.0/richard-hendriks.json' );
|
||||
var fileB = path.join( __dirname, 'sandbox/richard-hendriks.json' );
|
||||
|
||||
_sheet = new FRESHResume().open( fileA );
|
||||
|
@ -9,55 +9,61 @@ var chai = require('chai')
|
||||
|
||||
chai.config.includeStack = false;
|
||||
|
||||
describe('jane-doe.json (JRS)', function () {
|
||||
function testResume( opts ) {
|
||||
|
||||
describe( opts.title + ' (JRS)', function() {
|
||||
|
||||
opts.isValid = opts.isValid !== false;
|
||||
|
||||
var _sheet;
|
||||
|
||||
it('should open without throwing an exception', function () {
|
||||
it('should open without throwing an exception', function () {
|
||||
var that = this;
|
||||
function tryOpen() {
|
||||
_sheet = new JRSResume().open(
|
||||
path.join( __dirname, 'resumes/jrs/jane-q-fullstacker.json' ) );
|
||||
path.join( __dirname, 'resumes/jrs-0.0.0/' + opts.title + '.json' ) );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('should have one or more of each section', function() {
|
||||
expect(
|
||||
(_sheet.basics) &&
|
||||
(_sheet.work && _sheet.work.length > 0) &&
|
||||
(_sheet.skills && _sheet.skills.length > 0) &&
|
||||
(_sheet.education && _sheet.education.length > 0) &&
|
||||
(_sheet.volunteer && _sheet.volunteer.length > 0) &&
|
||||
(_sheet.publications && _sheet.publications.length > 0) &&
|
||||
(_sheet.awards && _sheet.awards.length > 0)
|
||||
).to.equal( true );
|
||||
var newObj = _.pick( _sheet, opts.sections );
|
||||
expect( Object.keys(newObj).length ).to.equal( opts.sections.length );
|
||||
});
|
||||
|
||||
it('should have a work duration of 7 years', function() {
|
||||
_sheet.basics.computed.numYears.should.equal( 7 );
|
||||
it('should have a work duration of ' + opts.duration + ' years', function() {
|
||||
_sheet.basics.computed.numYears.should.equal( opts.duration );
|
||||
});
|
||||
|
||||
it('should save without throwing an exception', function(){
|
||||
it('should save without throwing an exception', function() {
|
||||
var that = this;
|
||||
function trySave() {
|
||||
_sheet.save( 'tests/sandbox/jane-q-fullstacker.json' );
|
||||
_sheet.save( 'tests/sandbox/' + opts.title + '.json' );
|
||||
}
|
||||
trySave.should.not.Throw();
|
||||
});
|
||||
|
||||
it('should not be modified after saving', function() {
|
||||
var savedSheet = new JRSResume().open( 'tests/sandbox/jane-q-fullstacker.json' );
|
||||
var savedSheet = new JRSResume().open( 'tests/sandbox/' + opts.title + '.json' );
|
||||
_sheet.stringify().should.equal( savedSheet.stringify() )
|
||||
});
|
||||
|
||||
it('should validate against the JSON Resume schema', function() {
|
||||
it('should ' + (opts.isValid ? '' : 'NOT ') + 'validate against the JSON Resume schema', function() {
|
||||
var result = _sheet.isValid();
|
||||
// var schemaJson = require('../src/core/resume.json');
|
||||
// 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.basics.imp.validationErrors, "\n\n");
|
||||
result.should.equal( true );
|
||||
result.should.equal( opts.isValid );
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
var sects = [ 'basics', 'work', 'volunteer', 'skills', 'education', 'publications', 'awards', 'references' ];
|
||||
|
||||
testResume({ title: 'jane-q-fullstacker', duration: 7, sections: sects });
|
||||
testResume({ title: 'jane-incomplete', duration: 0, sections: _.without(sects, 'awards', 'work') });
|
||||
testResume({ title: 'richard-hendriks', duration: 1, sections: sects });
|
||||
testResume({ title: 'empty', duration: 0, sections: [], isValid: false });
|
||||
|
Loading…
Reference in New Issue
Block a user