summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
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