diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-06-07 11:06:53 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-06-07 11:06:53 +0200 |
commit | 67106e86981852d2d55830a8fca494c7d33eff37 (patch) | |
tree | b477ab3acb2b2db8f333e1e92a61432ae60dfb40 /testing/setup.js | |
parent | dc2ab51a8812636143430459fab97027ad60ce23 (diff) | |
download | gitbook-67106e86981852d2d55830a8fca494c7d33eff37.zip gitbook-67106e86981852d2d55830a8fca494c7d33eff37.tar.gz gitbook-67106e86981852d2d55830a8fca494c7d33eff37.tar.bz2 |
Improve plugins config modifier
Diffstat (limited to 'testing/setup.js')
-rw-r--r-- | testing/setup.js | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/testing/setup.js b/testing/setup.js index 59fef77..1105002 100644 --- a/testing/setup.js +++ b/testing/setup.js @@ -6,10 +6,9 @@ var cheerio = require('cheerio'); expect.extend({ /** - Check that a file is created in a directory: - - expect('myFolder').toHaveFile('hello.md'); - */ + * Check that a file is created in a directory: + * expect('myFolder').toHaveFile('hello.md'); + */ toHaveFile: function(fileName) { var filePath = path.join(this.actual, fileName); var exists = fs.existsSync(filePath); @@ -36,8 +35,8 @@ expect.extend({ }, /** - Check that a value is defined (not null nor undefined) - */ + * Check that a value is defined (not null nor undefined) + */ toBeDefined: function() { expect.assert( !(is.undefined(this.actual) || is.null(this.actual)), @@ -47,10 +46,21 @@ expect.extend({ }, /** - Check that a dom element exists in HTML + * Check that a value is defined (not null nor undefined) + */ + toNotBeDefined: function() { + expect.assert( + (is.undefined(this.actual) || is.null(this.actual)), + 'expected %s to be not defined', + this.actual + ); + return this; + }, - @param {String} selector - */ + /** + * Check that a dom element exists in HTML + * @param {String} selector + */ toHaveDOMElement: function(selector) { var $ = cheerio.load(this.actual); var $el = $(selector); |