diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/node_modules/gitbook-plugin-test-resources/index.js | 12 | ||||
-rw-r--r-- | test/node_modules/gitbook-plugin-test-resources/package.json | 7 | ||||
-rw-r--r-- | test/plugins.js | 24 |
3 files changed, 43 insertions, 0 deletions
diff --git a/test/node_modules/gitbook-plugin-test-resources/index.js b/test/node_modules/gitbook-plugin-test-resources/index.js new file mode 100644 index 0000000..e95e411 --- /dev/null +++ b/test/node_modules/gitbook-plugin-test-resources/index.js @@ -0,0 +1,12 @@ +module.exports = { + book: { + assets: './assets', + js: [ + 'myfile.js', + 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js' + ], + css: [ + 'myfile.css' + ] + } +}; diff --git a/test/node_modules/gitbook-plugin-test-resources/package.json b/test/node_modules/gitbook-plugin-test-resources/package.json new file mode 100644 index 0000000..606de31 --- /dev/null +++ b/test/node_modules/gitbook-plugin-test-resources/package.json @@ -0,0 +1,7 @@ +{ + "name": "gitbook-plugin-test-resources", + "version": "1.0.0", + "engines": { + "gitbook": "*" + } +}
\ No newline at end of file diff --git a/test/plugins.js b/test/plugins.js index 4fd59d4..576c96b 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -100,5 +100,29 @@ describe('Plugins', function() { }); }); }); + + describe('Resources', function() { + var plugin; + + before(function() { + plugin = new BookPlugin(book, 'test-resources'); + return plugin.load(PLUGINS_ROOT); + }); + + + it('should list all resources for website', function() { + return plugin.getResources('website') + .then(function(resources) { + resources.assets.should.equal('./assets'); + + resources.js.should.have.lengthOf(2); + resources.js[0].path.should.equal('gitbook-plugin-test-resources/myfile.js'); + resources.js[1].url.should.equal('https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js'); + + resources.css.should.have.lengthOf(1); + resources.css[0].path.should.equal('gitbook-plugin-test-resources/myfile.css'); + }); + }); + }); }); |