mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Add tests for book generation
This commit is contained in:
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
# This is a test
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
# Summary
|
||||
|
||||
* [test](test.md)
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
# Test
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
# This should fail
|
||||
@@ -0,0 +1,46 @@
|
||||
var _ = require('lodash');
|
||||
var Q = require('q');
|
||||
var path = require('path');
|
||||
var tmp = require('tmp');
|
||||
var assert = require('assert');
|
||||
|
||||
var generate = require("../lib/generate");
|
||||
|
||||
var generateTmpBook = function(path) {
|
||||
return ;
|
||||
};
|
||||
|
||||
|
||||
var BOOKS = {
|
||||
"book1": true,
|
||||
"book2": false
|
||||
};
|
||||
|
||||
describe('Site Generation', function () {
|
||||
var ret = {};
|
||||
|
||||
beforeEach(function(done){
|
||||
Q.all(_.map(BOOKS, function(state, bookName) {
|
||||
return Q.nfcall(tmp.dir)
|
||||
.then(function(_dir) {
|
||||
return generate.folder({
|
||||
input: path.join(__dirname, "fixtures", bookName),
|
||||
output: _dir
|
||||
});
|
||||
})
|
||||
.then(function(_book) {
|
||||
ret[bookName] = _book;
|
||||
}, function(err) {
|
||||
// ignore errors here
|
||||
});
|
||||
}))
|
||||
.fin(done);
|
||||
});
|
||||
|
||||
|
||||
it('should generate the valid sites', function() {
|
||||
_.each(BOOKS, function(state, bookName) {
|
||||
assert((ret[bookName] != null) == state);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user