mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Add test for copy of assets in website generator
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
"gitbook-plugin-sharing": "1.0.1",
|
||||
"gitbook-plugin-search": "1.1.0",
|
||||
"gitbook-plugin-fontsettings": "1.0.2",
|
||||
"gitbook-plugin-theme-default": "git+https://github.com/GitbookIO/gitbook-theme-default.git#master",
|
||||
"nunjucks": "2.3.0",
|
||||
"nunjucks-autoescape": "1.0.0",
|
||||
"nunjucks-filter": "1.0.0",
|
||||
|
||||
+5
-1
@@ -5,6 +5,7 @@ var path = require('path');
|
||||
|
||||
var Book = require('../').Book;
|
||||
var NodeFS = require('../lib/fs/node');
|
||||
var fs = require('../lib/utils/fs');
|
||||
|
||||
require('./assertions');
|
||||
|
||||
@@ -22,7 +23,10 @@ function setupFS(_fs, rootFolder, files) {
|
||||
if (_.isObject(buf)) buf = JSON.stringify(buf);
|
||||
if (_.isString(buf)) buf = new Buffer(buf, 'utf-8');
|
||||
|
||||
return _fs.write(filename, buf);
|
||||
return fs.mkdirp(path.dirname(filename))
|
||||
.then(function() {
|
||||
return fs.writeFile(filename, buf);
|
||||
});
|
||||
});
|
||||
}, Q())
|
||||
.value()
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
var mock = require('./mock');
|
||||
var WebsiteOutput = require('../lib/output/website');
|
||||
|
||||
describe('Website Output', function() {
|
||||
|
||||
describe('Sample Book', function() {
|
||||
var output;
|
||||
|
||||
before(function() {
|
||||
return mock.outputDefaultBook(WebsiteOutput)
|
||||
.then(function(_output) {
|
||||
output = _output;
|
||||
});
|
||||
});
|
||||
|
||||
it('should correctly generate an index.html', function() {
|
||||
output.should.have.file('index.html');
|
||||
});
|
||||
|
||||
it('should correctly copy assets', function() {
|
||||
output.should.have.file('gitbook/app.js');
|
||||
output.should.have.file('gitbook/images/favicon.ico');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user