2015-11-20 13:29:19 +00:00
|
|
|
|
|
|
|
var chai = require('chai')
|
|
|
|
, expect = chai.expect
|
|
|
|
, should = chai.should()
|
|
|
|
, path = require('path')
|
|
|
|
, _ = require('underscore')
|
|
|
|
, FRESHResume = require('../src/core/fresh-resume')
|
|
|
|
, CONVERTER = require('../src/core/convert')
|
|
|
|
, FS = require('fs')
|
2015-12-18 20:34:30 +00:00
|
|
|
, MKDIRP = require('mkdirp')
|
2015-11-20 13:29:19 +00:00
|
|
|
, _ = require('underscore');
|
|
|
|
|
|
|
|
chai.config.includeStack = false;
|
|
|
|
|
|
|
|
describe('FRESH/JRS converter', function () {
|
|
|
|
|
|
|
|
var _sheet;
|
|
|
|
|
|
|
|
it('should round-trip from JRS to FRESH to JRS without modifying or losing data', function () {
|
|
|
|
|
2015-12-12 15:48:26 +00:00
|
|
|
var fileA = path.join( __dirname, 'resumes/jrs/richard-hendriks.json' );
|
2015-12-12 09:42:56 +00:00
|
|
|
var fileB = path.join( __dirname, 'sandbox/richard-hendriks.json' );
|
2015-11-20 13:29:19 +00:00
|
|
|
|
|
|
|
_sheet = new FRESHResume().open( fileA );
|
2015-12-18 20:34:30 +00:00
|
|
|
MKDIRP.sync( path.parse(fileB).dir );
|
2015-11-20 13:29:19 +00:00
|
|
|
_sheet.saveAs( fileB, 'JRS' );
|
|
|
|
|
|
|
|
var rawA = FS.readFileSync( fileA, 'utf8' );
|
|
|
|
var rawB = FS.readFileSync( fileB, 'utf8' );
|
|
|
|
|
|
|
|
var objA = JSON.parse( rawA );
|
|
|
|
var objB = JSON.parse( rawB );
|
|
|
|
|
|
|
|
_.isEqual(objA, objB).should.equal(true);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|