mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 10:03:31 +00:00
Add assertion to test that a file exists
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@
|
||||
"grunt-bower-install-simple": "0.9.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node_modules/.bin/mocha --reporter list --timeout 15000"
|
||||
"test": "node_modules/.bin/mocha --reporter spec --timeout 15000"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var should = require('should');
|
||||
|
||||
should.Assertion.add('file', function(file, description) {
|
||||
this.params = { operator: 'have file ' + file, message: description };
|
||||
|
||||
this.obj.should.have.property('options').which.is.an.Object;
|
||||
this.obj.options.should.have.property('output').which.is.a.String;
|
||||
this.assert(fs.existsSync(path.resolve(this.obj.options.output, file)));
|
||||
});
|
||||
@@ -9,6 +9,9 @@ var fsUtil = require('../lib/utils/fs');
|
||||
var Book = require('../').Book;
|
||||
var LOG_LEVELS = require('../').LOG_LEVELS;
|
||||
|
||||
require("./assertions");
|
||||
|
||||
|
||||
var BOOKS = {};
|
||||
var TMPDIR = os.tmpdir();
|
||||
|
||||
|
||||
+7
-5
@@ -1,9 +1,11 @@
|
||||
|
||||
describe('JSON generator', function () {
|
||||
it('should correctly generate a basic book to json', function() {
|
||||
return books.generate("basic", "json")
|
||||
.then(function(book) {
|
||||
|
||||
});
|
||||
describe('Basic Book', function() {
|
||||
it('should correctly output a README.json', function() {
|
||||
return books.generate("basic", "json")
|
||||
.then(function(book) {
|
||||
book.should.have.file("README.json");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user