summaryrefslogtreecommitdiffstats
path: root/test/assertions.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-26 09:41:26 +0100
commitd3d64f636c859f7f01a64f7774cf70bd8ccdc562 (patch)
tree4f7731f37c3a793d187b0ab1cd77680e69534c6c /test/assertions.js
parent4cb9cbb5ae3aa8f9211ffa3ac5e3d34232c0ca4f (diff)
parenteef072693b17526347c37b66078a5059c71caa31 (diff)
downloadgitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.zip
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.gz
gitbook-d3d64f636c859f7f01a64f7774cf70bd8ccdc562.tar.bz2
Merge pull request #1109 from GitbookIO/3.0.0
Version 3.0.0
Diffstat (limited to 'test/assertions.js')
-rw-r--r--test/assertions.js29
1 files changed, 11 insertions, 18 deletions
diff --git a/test/assertions.js b/test/assertions.js
index f9c4ba3..56da249 100644
--- a/test/assertions.js
+++ b/test/assertions.js
@@ -1,25 +1,18 @@
-var _ = require('lodash');
var fs = require('fs');
-var path = require('path');
-var should = require('should');
+var _ = require('lodash');
var cheerio = require('cheerio');
+var should = require('should');
-require('should-promised');
-
+// Assertions to test if an Output has generated a file
should.Assertion.add('file', function(file, description) {
- this.params = { actual: this.obj.toString(), 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)));
-});
-
-should.Assertion.add('jsonfile', function(file, description) {
- this.params = { actual: this.obj.toString(), operator: 'have valid jsonfile ' + 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(JSON.parse(fs.readFileSync(path.resolve(this.obj.options.output, file), { encoding: 'utf-8' })));
+ this.params = {
+ actual: this.obj.root(),
+ operator: 'have file ' + file,
+ message: description
+ };
+
+ this.obj.should.have.property('resolve').which.is.a.Function;
+ this.assert(fs.existsSync(this.obj.resolve(file)));
});
should.Assertion.add('html', function(rules, description) {