summaryrefslogtreecommitdiffstats
path: root/jest/customMatchers.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-04-27 17:58:35 +0200
committerSamy Pessé <samypesse@gmail.com>2016-04-27 17:58:35 +0200
commite781d6d2b1705f44fcdd950f5541917fde41323f (patch)
tree309c2378efe990dfdb650a446de0640eafd2cdfe /jest/customMatchers.js
parent5b342b50ce862a4d60002451e6c1abd09a7b20ce (diff)
downloadgitbook-e781d6d2b1705f44fcdd950f5541917fde41323f.zip
gitbook-e781d6d2b1705f44fcdd950f5541917fde41323f.tar.gz
gitbook-e781d6d2b1705f44fcdd950f5541917fde41323f.tar.bz2
Add test for assets inliner
Diffstat (limited to 'jest/customMatchers.js')
-rw-r--r--jest/customMatchers.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jest/customMatchers.js b/jest/customMatchers.js
new file mode 100644
index 0000000..a0dd7f9
--- /dev/null
+++ b/jest/customMatchers.js
@@ -0,0 +1,24 @@
+var path = require('path');
+var fs = require('fs');
+
+var matchers = {
+ /**
+ Verify that a file exists in a directory
+ */
+ toHaveFile: function () {
+ return {
+ compare: function (actual, expected) {
+ var filePath = path.join(actual, expected);
+ var exists = fs.existsSync(filePath);
+
+ return {
+ pass: exists
+ };
+ }
+ };
+ }
+};
+
+jasmine.getEnv().beforeEach(function () {
+ jasmine.addMatchers(matchers);
+}); \ No newline at end of file