amie
Version:
Amalgamation Made Insanely Easy. A tool to easily amalgamate stuff!
36 lines (30 loc) • 911 B
JavaScript
;
const path = require('path');
const proxyquire = require('proxyquire').noPreserveCache();
let amie;
const should = require('should');
const sinon = require('sinon');
require('should-sinon');
let readFileStub;
readFileStub = sinon.stub().throws();
amie = proxyquire('../../', {
'fs': null
});
describe('Caching', function() {
it('should not read the file twice', function(done) {
amie({
input: '#include "file.hh"\n#include "file.hh"',
fromString: true,
includePaths: [
path.join(__dirname, 'cpp')
]
}, (err, result) => {
should.not.exist(err);
should.exist(result);
result.should.be.a.String();
result.should.equal('// This is file from cpp\n\n\n// main.cpp\n');
readFileStub.should.be.calledOnce();
done();
});
});
});