summaryrefslogtreecommitdiffstats
path: root/testing/setup.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
committerSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
commita14ca3e268e95a7eab59fb205b41da7331d57631 (patch)
tree9c84b2cbd561345335fca3e26af961b2ea23d8ec /testing/setup.js
parent9c071dade573aa6990878006f83c89b6065a1395 (diff)
downloadgitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.zip
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.gz
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.bz2
Switch to lerna
Diffstat (limited to 'testing/setup.js')
-rw-r--r--testing/setup.js72
1 files changed, 0 insertions, 72 deletions
diff --git a/testing/setup.js b/testing/setup.js
deleted file mode 100644
index 1105002..0000000
--- a/testing/setup.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var is = require('is');
-var path = require('path');
-var fs = require('fs');
-var expect = require('expect');
-var cheerio = require('cheerio');
-
-expect.extend({
- /**
- * 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);
-
- expect.assert(
- exists,
- 'expected %s to have file %s',
- this.actual,
- fileName
- );
- return this;
- },
- toNotHaveFile: function(fileName) {
- var filePath = path.join(this.actual, fileName);
- var exists = fs.existsSync(filePath);
-
- expect.assert(
- !exists,
- 'expected %s to not have file %s',
- this.actual,
- fileName
- );
- return this;
- },
-
- /**
- * Check that a value is defined (not null nor undefined)
- */
- toBeDefined: function() {
- expect.assert(
- !(is.undefined(this.actual) || is.null(this.actual)),
- 'expected to be defined'
- );
- return this;
- },
-
- /**
- * 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;
- },
-
- /**
- * Check that a dom element exists in HTML
- * @param {String} selector
- */
- toHaveDOMElement: function(selector) {
- var $ = cheerio.load(this.actual);
- var $el = $(selector);
-
- expect.assert($el.length > 0, 'expected HTML to contains %s', selector);
- }
-});
-
-global.expect = expect;