summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-26 21:42:30 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-26 21:42:30 +0100
commit4250f559b0a2047fb172248dca0bbd0ab3b9c6fb (patch)
tree8bb5ec8e51886836f4637aedb1b0677299575b4c /test
parent3293c394508ef40a65068a19f04deda467431864 (diff)
downloadgitbook-4250f559b0a2047fb172248dca0bbd0ab3b9c6fb.zip
gitbook-4250f559b0a2047fb172248dca0bbd0ab3b9c6fb.tar.gz
gitbook-4250f559b0a2047fb172248dca0bbd0ab3b9c6fb.tar.bz2
Extract filters from plugins
Diffstat (limited to 'test')
-rw-r--r--test/plugins.js15
-rw-r--r--test/plugins/filters/index.js7
-rw-r--r--test/plugins/filters/package.json9
3 files changed, 31 insertions, 0 deletions
diff --git a/test/plugins.js b/test/plugins.js
index f75af34..cd46246 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -35,4 +35,19 @@ describe('Plugins', function () {
done);
});
});
+
+ describe('filters', function() {
+ var plugin = new Plugin(books[0], "filters");
+ plugin.load("./filters", PLUGINS_ROOT);
+
+ it('should valid a plugin', function() {
+ assert(plugin.isValid());
+ });
+
+ it('should return a map of filters', function() {
+ var filters = plugin.getFilters();
+ assert.equal(_.size(filters), 1);
+ assert(filters["hello"]);
+ });
+ });
});
diff --git a/test/plugins/filters/index.js b/test/plugins/filters/index.js
new file mode 100644
index 0000000..0087ba1
--- /dev/null
+++ b/test/plugins/filters/index.js
@@ -0,0 +1,7 @@
+module.exports = {
+ filters: {
+ hello: function(text) {
+ return "Hello "+text;
+ }
+ }
+}; \ No newline at end of file
diff --git a/test/plugins/filters/package.json b/test/plugins/filters/package.json
new file mode 100644
index 0000000..f1d4e45
--- /dev/null
+++ b/test/plugins/filters/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "gitbook-plugin-filters",
+ "description": "Test filters",
+ "main": "index.js",
+ "version": "0.0.1",
+ "engines": {
+ "gitbook": "*"
+ }
+} \ No newline at end of file