2015-12-09 10:41:04 +00:00
|
|
|
|
2016-01-09 10:29:45 +00:00
|
|
|
var chai = require('chai')
|
2015-12-09 10:41:04 +00:00
|
|
|
, expect = chai.expect
|
|
|
|
, should = chai.should()
|
|
|
|
, path = require('path')
|
|
|
|
, _ = require('underscore')
|
|
|
|
, FRESHResume = require('../src/core/fresh-resume')
|
2016-01-04 12:23:20 +00:00
|
|
|
, HMR = require( '../src/hackmyapi')
|
2016-01-02 01:26:47 +00:00
|
|
|
, validator = require('is-my-json-valid')
|
|
|
|
, READFILES = require('recursive-readdir-sync')
|
|
|
|
, fileContains = require('../src/utils/file-contains')
|
2016-01-09 11:44:47 +00:00
|
|
|
, FS = require('fs')
|
|
|
|
, CHALK = require('chalk');
|
2015-12-09 10:41:04 +00:00
|
|
|
|
2016-01-02 05:15:46 +00:00
|
|
|
chai.config.includeStack = true;
|
2015-12-09 10:41:04 +00:00
|
|
|
|
2015-12-31 02:07:28 +00:00
|
|
|
function genThemes( title, src, fmt ) {
|
|
|
|
|
|
|
|
describe('Testing themes against ' + title.toUpperCase() + ' resume ' + '(' + fmt + ')' , function () {
|
2015-12-09 10:41:04 +00:00
|
|
|
|
|
|
|
var _sheet;
|
|
|
|
|
2015-12-28 09:39:03 +00:00
|
|
|
function genTheme( fmt, src, themeName, themeLoc, testTitle ) {
|
|
|
|
themeLoc = themeLoc || themeName;
|
2015-12-31 02:07:28 +00:00
|
|
|
testTitle = themeName.toUpperCase() + ' theme (' + fmt + ') should generate without throwing an exception';
|
2015-12-28 09:39:03 +00:00
|
|
|
it( testTitle, function () {
|
2015-12-12 16:13:37 +00:00
|
|
|
function tryOpen() {
|
2015-12-28 09:39:03 +00:00
|
|
|
//var src = ['node_modules/jane-q-fullstacker/resume/jane-resume.json'];
|
2015-12-31 02:07:28 +00:00
|
|
|
var dst = ['test/sandbox/' + fmt + '/' + title + '/' + themeName + '/resume.all'];
|
2015-12-12 16:13:37 +00:00
|
|
|
var opts = {
|
2015-12-28 09:39:03 +00:00
|
|
|
theme: themeLoc,
|
|
|
|
format: fmt,
|
2015-12-12 16:13:37 +00:00
|
|
|
prettify: true,
|
2016-01-04 12:23:20 +00:00
|
|
|
silent: false,
|
|
|
|
css: 'embed'
|
2015-12-12 16:13:37 +00:00
|
|
|
};
|
2016-01-04 12:23:20 +00:00
|
|
|
try {
|
2016-01-09 11:44:47 +00:00
|
|
|
var v = new HMR.verbs.build();
|
|
|
|
v.invoke( src, dst, opts, function(msg) {
|
2016-01-04 12:23:20 +00:00
|
|
|
msg = msg || '';
|
|
|
|
console.log(msg);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
catch(ex) {
|
|
|
|
console.log(ex);
|
|
|
|
console.log(ex.stack);
|
|
|
|
throw ex;
|
|
|
|
}
|
2015-12-12 16:13:37 +00:00
|
|
|
}
|
|
|
|
tryOpen.should.not.Throw();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-12-31 02:07:28 +00:00
|
|
|
genTheme(fmt, src, 'hello-world');
|
|
|
|
genTheme(fmt, src, 'compact');
|
|
|
|
genTheme(fmt, src, 'modern');
|
2016-01-11 23:08:31 +00:00
|
|
|
genTheme(fmt, src, 'underscore');
|
2015-12-31 02:07:28 +00:00
|
|
|
genTheme(fmt, src, 'awesome');
|
|
|
|
genTheme(fmt, src, 'positive');
|
|
|
|
genTheme(fmt, src, 'jsonresume-theme-boilerplate', 'node_modules/jsonresume-theme-boilerplate' );
|
|
|
|
genTheme(fmt, src, 'jsonresume-theme-sceptile', 'node_modules/jsonresume-theme-sceptile' );
|
|
|
|
genTheme(fmt, src, 'jsonresume-theme-modern', 'node_modules/jsonresume-theme-modern' );
|
|
|
|
genTheme(fmt, src, 'jsonresume-theme-classy', 'node_modules/jsonresume-theme-classy' );
|
|
|
|
|
|
|
|
});
|
2015-12-28 09:39:03 +00:00
|
|
|
|
2015-12-31 02:07:28 +00:00
|
|
|
}
|
2015-12-09 10:41:04 +00:00
|
|
|
|
2016-01-02 01:26:47 +00:00
|
|
|
function folderContains( needle, haystack ) {
|
|
|
|
return _.some( READFILES( path.join(__dirname, haystack) ), function( absPath ) {
|
|
|
|
if( FS.lstatSync( absPath ).isFile() ) {
|
|
|
|
if( fileContains( absPath, needle ) ) {
|
|
|
|
console.log('Found invalid metadata in ' + absPath);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-01-05 00:45:49 +00:00
|
|
|
genThemes( 'jane-q-fullstacker', ['node_modules/fresh-test-resumes/src/jane-fullstacker.fresh.json'], 'FRESH' );
|
|
|
|
genThemes( 'johnny-trouble', ['node_modules/fresh-test-resumes/src/johnny-trouble.fresh.json'], 'FRESH' );
|
2015-12-31 02:07:28 +00:00
|
|
|
genThemes( 'richard-hendriks', ['test/resumes/jrs-0.0.0/richard-hendriks.json'], 'JRS' );
|
2016-01-02 01:26:47 +00:00
|
|
|
|
|
|
|
describe('Verifying generated theme files...', function() {
|
|
|
|
it('Generated files should not contain ICE.', function() {
|
|
|
|
expect( folderContains('@@@@', 'sandbox') ).to.be.false;
|
|
|
|
});
|
|
|
|
});
|