diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-22 10:36:28 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-22 10:36:28 +0100 |
commit | 1e243281c7f0444162dfb8593e9fd9ac2aa725ab (patch) | |
tree | d573af3258a36702ce7524f0a2143a07dece2d4e /test | |
parent | de234944090dcb2356db1185e3fba7935dc6ee11 (diff) | |
download | gitbook-1e243281c7f0444162dfb8593e9fd9ac2aa725ab.zip gitbook-1e243281c7f0444162dfb8593e9fd9ac2aa725ab.tar.gz gitbook-1e243281c7f0444162dfb8593e9fd9ac2aa725ab.tar.bz2 |
Add test for resources listing
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'); + }); + }); + }); }); |